CT Textbook Site
  

Magic Tray Game

Create Your Solution

The Problem: A magic square tray has four corner pockets. Inside each pocket is a cup hidden from view. It also has a green light at the center of the tray.

Cups inside the pockets can be either up or down. The light will only turn red if all four cups are in the same orientation.

Your job is to turn the light red by reaching into up to two pockets to feel/change the cups. Unfortunately, the tray spins wildly after you take your hands out of the pockets. After it stops spinning, there is no way to know which pockets you had reached into last time.

Can you create an algorithm to turn the light red assuming nothing on the initial configuration of the cups?

Create Your Algorithm

Enter Next Step:  

                             


Challenges

  • Try avoiding repeating an internal state.
  • Try to minimize the number of steps. How about using 5 steps or less?

Hint: Reaching into pockets on a side or on a diagonal. Apply CT and consider the problem from the begining and from the end.