The solution implements the algorithm of Buneman and Levy as follows:

  1. The state "odd" moves the smallest disk clockwise to the next tower and changes to the state "even 0".
  2. The state "even 0" searches the lower end of the current tower. If the end is found (an empty field) the Turing Machine changes into the state "even 1", or terminates otherwise.
  3. If TuringKara is on a 0 in the state "even 1", the 0 is moved one tower clockwise (cyclic) to the right. Afterwards it changes into the state "climb". If TuringKara is on an empty field, it changes to the state "even 2".
  4. If TuringKara is on a 0 in the state "even 2", the 0 is moved two towers clockwise (cyclic) to the right. Afterwards, it changes into the state "climb".
  5. The state "climb" searches the topmost row of the towers and changes into the state "odd", where the game continues.