def play
      index = 0
      hist = Array.new(3, "")

      loop do
        puts "\e[H\e[2J"
        puts self.positions[index].inspect
        hist[0..2] = (hist[1..2] << STDIN.getch)

        case hist.join
        when LEFT
          index -= 1 if index > 0
        when RIGHT
          index += 1 if index < self.moves.length
        when EXIT
          break
        end
      end
    end
def play
      index = 0
      hist = Array.new(3, "")

      loop do
        puts "\e[H\e[2J"
        puts self.positions[index].inspect
        hist[0..2] = (hist[1..2] << STDIN.getch)

        case hist.join
        when LEFT
          index -= 1 if index > 0
        when RIGHT
          index += 1 if index < self.moves.length
        when EXIT
          break
        end
      end
    end
Interactively step through the game

 Use +d+ to move forward, +a+ to move backward, and +^C+ to exit.