1 # Copyright (c) 2009 Paolo Capriotti <p.capriotti@gmail.com>
3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 2 of the License, or
6 # (at your option) any later version.
11 attr_reader :move_factory, :piece_factory
13 def initialize(board, move_factory, piece_factory)
15 @move_factory = move_factory
16 @piece_factory = piece_factory
19 def initialize_copy(other)
20 @board = other.board.dup
30 captured = @board[move.dst]
31 @board[move.dst] = @board[move.src]
32 @board[move.src] = nil
36 def promote_on!(p, type)
38 @board[p] = piece_factory.new(@board[p].color, type)
44 "turn #{@turn.to_s}"].join("\n")
48 @board == other.board &&