DEV Community

loading...

Discussion on: How to Solve Any Algorithm

Collapse
sharpninja profile image
The Sharp Ninja

With the duck on the far side, neither remaining item can be brought over without failing the outcome as the fox will eat the duck when returning for the corn or the duck will eat the corn when returning for the fox. The algorith is missing a cage for the duck to always protect it from the fox and the corn frim the duck. Sometimes critical analysis shows where a flaw in the system can only be fixed by adding complexity.

Collapse
sbleks profile image
Bleks
  1. Farmer brings duck to side b
  2. Farmer goes back to side a
  3. Farmer brings fox over to side b
  4. Farmer brings duck back to side a
  5. Farmer brings corn to side b
  6. Farmer goes back to side a
  7. Farmer brings duck to side b

This way the Fox is never left alone with the duck and the duck is never left alone with the corn while getting all three to side b. No need for a cage!

Collapse
sharpninja profile image
The Sharp Ninja

Cool! But the cage is more efficient. ;)

Thread Thread
pengriffey profile image
pengriffey

The cage is less efficient

Thread Thread
sharpninja profile image
The Sharp Ninja

The cage requires less trips, plus you can stack stuff on it. Put the fox in another cage and lash them together for more efficiency.

Collapse
naveennamani profile image
naveennamani

Simple solutions do exist when you "think outside the box".