Solution to Logic Puzzle

The problem we want to solve is how to color three cubes so that the closest is red, the next closest is green, and the farthest is blue. We can make no assumptions about the initial colors of any of the cubes.

Solving the for the first two cubes is straightforward: we can use "WHEN see cube" to find the closest, and "WHEN see cube NOT-it" to find the next closest. To color the third cube we will have to make two tries, and take advantage of the fact that the first two cubes have already been colored correctly (the Fifth Law of Calypso). Here is the solution:


Note that the parent of the fourth rule is the first rule, not the second or third. So the "NOT-it" in the WHEN part of the fourth rule refers to the first rule's it, not the second or third rule's. There are two cases to consider:

  • If the farthest cube is not red, the third rule's WHEN part will find that cube because the "NOT-it" rules out the second closest cube and the "NOT-red" rules out the first closest, which we know has already been colored red due to the Fifth law.

  • On the other hand, if the farthest cube is currently red, the third rule will fail, but the fourth rule will find it because the "NOT-it" rules out the closest cube and the "red" rules out the next closest, which we know has already been colored green due to the Fifth Law.

Since either the third or the fourth rule will find the farthest cube, we are assured that the farthest cube will end up blue.


Back to Calypso Curriculum overview.


Copyright © 2020 Visionary Machines LLC.