37 @board = Grid.new(size)
52 @board[m] = Piece.new(@turn)
57 @turn = if @turn == :white
66 res = check_line(line)
67 return "#{res} wins" if res
69 @grid.each_square do |i|
70 return "in play" unless @grid[i]
78 res.board = board.clone
83 @turn == other.turn and @board == other.board
88 yield (0..2).map{|y| Point.new(i, y) }
89 yield (0..2).map{|x| Point.new(x, i) }
92 yield (0..2).map{|x| Point.new(x, x) }
93 yield (0..2).map{|x| Point.new(x, 2 - x) }
99 return false if col and col != val.color
110 KBoard.register "Tic Tac Toe", TicTacToe