1 require 'observer_utils'
9 def initialize(board, history)
13 board.add_observer self
17 @history.add_move(data[:state], data[:move])
18 @board.highlight(data[:move])
22 state, move = @history.back
23 @board.back(state.dup, move)
24 @board.highlight(@history.move)
25 rescue History::OutOfBound
26 puts "error: first move"
30 state, move = @history.forward
31 @board.forward(state.dup, move)
32 @board.highlight(move)
33 rescue History::OutOfBound
34 puts "error: last move"