A few weeks ago, I dropped in to see Ernie to ask if he was willing to look after the cat while I was on holiday in the Caribbean. “No problem.” he replied then showed me an old leather-covered book, “But here’s an interesting coincidence. I was cleaning out the attic at Aunt Bismarkia’s place yesterday, and I found a diary written by my great-great-great-great-great-great-great-great-uncle Earnest. He met up with pirates and made the family fortune in the Caribbean.”, and began to read from the tattered old book as follows:

*Jan 13th 1769 uncharted in t’ Caribbean sea : Shipwreck’d & cast up on this desolat shore. But I have found sweet water, fruit &c. ‘tho the wild creaturs are fereful. & also I have made a shelter from the tempest.

Jan 23rd Sqare Isle : I have map’d the island & drawn a chart o’ it. It is 10 leagues exact on a side. Naming it Square Isle due to it’s particul’r shape & built a fine signal pyre betwixt beach and forest in hopes its smoke & flame &c. will bring rescuers.

enter image description here

Feb 1st Sqare Isle: In the reef to th’ north there are many oysters. To th’ most-part every shell hides a pearl of great beutie and size – I have hidd’n all but the largest 1 of them for fear of pyrates. The largest I wear on a string ‘bout my neck in the fashion of a savage.

Feb 14th Sqare Isle: A sail – I must hasten to light the signal fire...

3 year later after I find this diarie again: As the ship stopp’d I spied a black flag upon the main-mast – it was crew’d by pyrates. They took my pearl and my map (but showed no interest in my diary, pen &c.). & dragg’d me to the Cap’ns cabin, bound at wrist, where there were 3 pyrates most sanguinolent of aspect and each identical to the others.

“Are you 3”, I asked, “the infamous Dread Pyrate Triplets?” “We are they” – spoke 1 – “and more dread than even the legends claim. Shew us where you have hidden your other pearls or we will torture you most ‘orribly!” – and one pyrate shew’d me a cruel dagger.

“Do not harm me”, I implored, “I shall draw a cross on the chart forthwith”. But they held back my hand. “Draw not a mark, nor speak the location for our crew are scoundrels all. If perchance they spied the map or overhear they might avail theyselves of the treasure a’fore us. Then we would torture you most ‘orribly!”

“Do not harm me”, I implored again, “for I can whisper the location in your ear – each in turn”. But they stayed me to my chair. “Seal your lips. For each of us has no trust for his brothers & if the 1st to hear could avail themself of the treasure a’fore the others he would perchance take all. And the 2nd and 3rd would torture you most ‘orribly”.

“Do not harm me” I cried, “but answer these questions 3.

Show me 1st where the ship is harb’r’d” And they drew a rude cross on the chart signifying the anchorage.

“And you all are navigateurs?” I asked. And they replied “Navigateurs most skilled, but the crew have not this skill”.

*“Then tell me true – you are alike in visage and physiognomy, but is there any difference measurable betwixt you?“ * And the first replied “I swims at 12 leagues to the hour, but am only ½ as fast in jungle and ¼ as fast on swamp land.” And the second replied “Whereas I wades at 14 leagues in the hour on swamp land but am only ½ as fast in water and ¼ as fast in jungle”. And the third replied “And I sneaks through jungle at 19 leagues in the hour but am only ½ as fast in water and ¼ as fast on swamp land”.

“If that all be true”, said I “then the treasure is yours to share.

For it is sunken 3 fathoms down with great cunning some leagues to the ENE of here, but if each and every one o’ you departs from this very point at the same turn o’ the hour-glass, & each and every one o’ you takes his own best & fastest course using only the means given to your body by God, then each and every one o’ you will arrive at the treasure together – & not a pace will separate the 3 of you & not a heart-beat will pass between the first & the last to arrive”. But I warn’d them not of the great sharks & poisn snakes & sentipiedes & other divers creaturs that lurk’d in the sea, swamp, and jungle.

And the Dread Brothers arose as 1 & left in great haste. And I heard 3 splashes as 1, as the Dread Brothers threw themselves in the water to begin swimming to their goal – as each fear’d the others might get to the treasure 1st and take it all. In their awful haste they left the dagger and the 1 pearl on the table so I cut my bonds hencewith and took up my pearl & hid below decks in the bilges where the crew could not spy me. But less than 1 hour pass’d and there was a suddenlike cry and commotion & the sound of great guns and the ship gave a shaking & rending &c. most awful. I was in fear of my life & left my noisome hiding place and reach’d the fore-deck to spy the a 2-decker flying the Kings flag alongside with guns blazing, & the pyrate crew tore down their flag in surrender & the guns were silenced tho’ the pyrate ship was mortal damaged & did sink thereafter. The crew was clapp’t in irons but of the 3 Dread Brothers who had not returned from their mission nothing was found of them ever – mayhaps they were consum’d by the wild beasts a’fore reaching the treasure or whilst maroon’d. Perchance, I knew the Cap’n of HMS Blenheim from my time in Portsmouth so I was free’d. I ask’d time to recover my treasure but the Cap’n said we must sail as there was a g’t storm on the horizon – but I w’d be reward’d by the Crown as t’was my signal pyre that allowed capture of the pyrate band. And his word was good & I was rewarded 200 sovereign by HM Governor in Freeport and 100 more by Viscount Cranborne for my 1 last pearl. Thus I made my fortune.

“Even more of a coincidence”, I replied in excitement. “The resort is on a place called Square Island, just a couple of hundred km off the coast of Jamaica. Do you think it could be the same place – and could the pearls still be hidden there?” “(G^8)Uncle Earnest never provided a latitude or longitude so I guess we can never tell”, Ernie replied. “But while you are on holiday, you could always have a look and see”. And he passed me Earnest's original hand-drawn chart.

To be honest, Ernie doesn’t think there is much chance – he isn’t even sure he really believes the old tale – so he didn’t want to “humour me” working out if there is sufficient information in the diary to locate the pearls. So here is the deal – if anyone can confirm where to look, and I do find Earnest's cache – I promise to let you in on an equal share of the profits with Ernie and me!

  • 2
    $\begingroup$ I'd like to know how anyone can swim 12 leagues an hour (= 18.52 m/s, which is faster than anyone can run on land). $\endgroup$
    – user88
    May 23, 2016 at 19:48
  • 1
    $\begingroup$ Ernie has his doubts too. Recent analysis of the Cranbourne pearl confirms it is a Pacific pearl so couldn't have come from the Caribbean. There are no historic records of any pirate 'triplets' in the late 18th century, and HMS Blenheim spent all of February 1769 on survey in Nova Scotia according to Admiralty records. Note that there is a record of a 'Spanish' passenger Ernesto Pseudonymo, on the passenger manifest of a ship that sailed between Cuba and Haiti in Dec 1768 and on which a sack of Pacific pearls went missing.You might make your own conclusions, but I couldn't possibly comment. $\endgroup$
    – Penguino
    May 23, 2016 at 21:02

4 Answers 4


In order to solve this problem, I used a combination of a flood-fill algorithm and Dijkstra's algorithm.

I set up a large grid of cells over the map. Each cell remembers its current distance and its "last source." The initial cell (the location of the ship) starts with zero distance, and source equal to itself. All other cells are uninitialized.

The algorithm keeps track of a list of cells with a priority queue. Each iteration it examines the cell in the queue with the smallest distance. It checks to see if the previously visited cell's source is both in the same region as the current cell, and has "line-of-sight" to the current cell (i.e. the straight-line path between current cell and previous source cell does not pass through any other regions). If is the case, the current cell's source is set to the previous source, otherwise the current cell's source is set to the previously visited cell.

The distance of the current cell is then calculated as the distance of the cell's source, plus the Euclidean distance from the source to the current cell divided by the pirate's speed over the current terrain. If this distance is less than the current cell's distance, the current cell's distance and source are updated and all its neighbors are added to the priority queue.

Running this algorithm with the three pirate's speeds (as given by Joe Z.) results in the following three distance contour plots:

enter image description here

enter image description here

enter image description here

If I take the maximum difference between distances at each point, I then obtain the following:

enter image description here

There are three different candidate points, if we ignore the ship itself. One is located on the west shore of the island. The second is in the water to the east of the island. Finally, there is one in the water to the northeast of the island.

Now because the algorithm I used keeps track of the "source" cell for each distance calculation, we can show the paths that each pirate used to arrive at each point (the paths are red, green, and blue for the first, second, and third pirate, respectively):

enter image description here

I assume, due to the line from the diary:

[the pearl] is hidden with great cunning some leagues to the East of here

That the actual location is the one off the east shore of the island. Knowing roughly the shortest paths for each pirate, the solution becomes a tedious optimization problem in a few variables. Solving the system of equations yields the orange point in the above diagram, which is located:

4.068527 leagues east and 5.250636 leagues north of the south-east corner of the island.

Alternatively, if you want to search the north-east point as well, it's located:

3.507273 leagues east and 2.329233 leagues north of the north-east corner of the island.

Finally, the (two!) candidate points on the west shore are located:

0.503264 leagues inland, 2.267151 leagues north and south of the ship.


Here is an animation of the "circles of accessibility" mentioned in Joe Z.'s answer:

enter image description here

  • $\begingroup$ None of the candidate spots seem to match the description of the story, but from your methods (and awesome animation, BTW) I'm leaning toward my interpretation of the story being wrong rather than your answer having a mistake. $\endgroup$
    – Rob Watts
    May 27, 2016 at 22:38
  • 3
    $\begingroup$ A wonderful answer - your detailed coordinates and animated map were of great help in my quest for the treasure. Unfortunately, "progress" on the island has resulted in holiday condominiums being planted on both your land-based solutions, and break-waters laid meters-deep over both the water-based solutions. So, alas, there is no profit to share. $\endgroup$
    – Penguino
    May 29, 2016 at 22:06
  • 3
    $\begingroup$ Also, that's an amazing gif. The only way I could think of making it better is to draw the points where all three circles intersect as they appear, and maybe have an indicator of how much time has passed. $\endgroup$
    – user88
    May 30, 2016 at 5:24
  • 2
    $\begingroup$ @JoeZ. Ask and ye shall receive =) $\endgroup$ May 31, 2016 at 3:12
  • 1
    $\begingroup$ Wish I could give another +1 for that badass response to @JoeZ.'s request. Awesome answer and illustration. $\endgroup$ May 31, 2016 at 3:13

Partial solution to gather information:

The essential parts of this puzzle are simply the speeds at which each pirate can traverse each type of terrain, which can be represented in a table:

Water Swamp Jungle
Pirate 1 12 3 6
Pirate 2 7 14 3.5
Pirate 3 9.5 4.75 19

And the problem is to find the point where the optimal paths for each of these speeds are the exact same distance.

One way I can think of doing this is to model the problem as "circles of accessibility", which grow at different rates depending on the speed of each pirate, and the answer is where the three circles intersect at a single point.

  • 6
    $\begingroup$ I wonder if the "circles of accessibility" could be found by using wave mechanics. The pirates' paths should behave like refracting beams of light, with each type of terrain being a material with a different refractive index. $\endgroup$
    – f''
    May 23, 2016 at 5:58
  • $\begingroup$ @f'' That's actually what I was thinking of — that's how we modelled it in optics class in high school physics. $\endgroup$
    – user88
    May 23, 2016 at 18:32
  • $\begingroup$ I can't think of an elegant way to do it with equations, though. $\endgroup$
    – user88
    May 23, 2016 at 19:47
  • 3
    $\begingroup$ Refracting pirates - I like the image. $\endgroup$
    – Penguino
    May 23, 2016 at 21:13
  • $\begingroup$ @f'' I tried this, but I eventually ran into problems with the corners. Specifically, at pretty much every corner you have to effectively start a new raytrace (to account for things like going around the corner of a slow region, or entering the corner of a fast region). $\endgroup$ May 26, 2016 at 4:17

The Pearl is

In the top row of intersections, 5th intersection from the right or 11th intersection from the left if you prefer.


I put in each pirates' possible path into an excel spreadsheet (I mapped the intersections of the leagues) and found the location where they least differed.

Here are the maps for each pirate. [Water Pirate] [Swamp Pirate] [Jungle Pirate]

I didn't map out their actual paths but I can do so upon request.

  • $\begingroup$ I specifically put the pictures in hyperlinks because when I tried putting them in the spoiler tags it caused the tags to always show their contents. $\endgroup$
    – dcfyj
    May 25, 2016 at 13:48
  • $\begingroup$ That might help a bit (assuming you have got the right region) - but an area one league square is too big for me to search in a practical time. After all, it is my holiday, and I want to spend at least some of it sunbathing on the beach. Can you track things down a bit more accurately? $\endgroup$
    – Penguino
    May 26, 2016 at 2:59
  • 1
    $\begingroup$ Does this answer presuppose that the pirates can only travel exactly North, exactly South, exactly East or exactly West through each grid section? And that the treasure is located at one of the intersections and not possibly inside one of the grid sections? $\endgroup$
    – Chowzen
    May 26, 2016 at 11:30
  • 1
    $\begingroup$ @Chowzen yes, I was hoping it would be the case but Penguino's reply says otherwise, sadly. $\endgroup$
    – dcfyj
    May 26, 2016 at 11:35
  • $\begingroup$ OIC... I didn't notice that Penguino's comment was from the Question Asker. Understanding now. $\endgroup$
    – Chowzen
    May 26, 2016 at 11:52

The pearl is:

Inside the (fake) large pearl.


It's an extremely large (and therefore fake) pearl. Regardless of the pirates' ability (or inefficiency) to traverse water, swamp and jungle, they traverse the decks of the pirate ship at exactly the same rate. They could run to the pearl (which is on the eastern side of the ship) in equal time, but they thought that the pearls were buried on the island. The pirate ship "was mortal damaged & did sink thereafter," so a little scuba diving on the "X" on the map would find the wreckage of the ship, the fake Large Pearl and the pearly treasures inside!

  • $\begingroup$ An interesting thought, I'm confident that the answer requires doing the hard math. If you look at Penguino's other "Ernie" puzzles, they consistently require very difficult math and have few red herrings! $\endgroup$
    – Kevin
    May 23, 2016 at 19:38
  • 8
    $\begingroup$ I don't understand the comment regarding herrings. I believe they are a cold water fish, so shouldn't be found in tropical climes. And I am almost certain that only shell-fish manufacture pearls. $\endgroup$
    – Penguino
    May 23, 2016 at 21:12
  • $\begingroup$ A red herring is (often) a diversion from the truth in order to mislead. Or were you being funny? $\endgroup$
    – Chowzen
    May 23, 2016 at 21:23
  • $\begingroup$ @Chowzen I guess Ernie's rubbing off on him $\endgroup$
    – No Name
    Jun 11, 2022 at 2:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.