protected State( ICell<State> state, GameBoard board ) { this.state = state; this.board = board; }
public InProgress( ICell<State> state, GameBoard board, Player player ) : base(state, board) { this.currentPlayer = player; }
private GameState( GameBoard initialBoard, Player initialPlayer ) : this(CreateInitialState( initialBoard, initialPlayer )) { // NOP }
public GameOver( ICell<State> state, GameBoard board ) : base(state, board) { }
private static ICell<State> CreateInitialState( GameBoard initialBoard, Player initialPlayer ) { if ( !initialBoard.HasValidMove( initialPlayer ) ) { throw new ArgumentException( "No move available for given player" ); } else { var state = new Cell<State>(); state.Value = new InProgress( state, initialBoard, initialPlayer ); return state; } }
public bool Equals( GameBoard gameBoard ) { return this.grid.Equals( gameBoard.grid ); }