Пример #1
0
 protected State( ICell<State> state, GameBoard board )
 {
     this.state = state;
     this.board = board;
 }
Пример #2
0
 public InProgress( ICell<State> state, GameBoard board, Player player )
     : base(state, board)
 {
     this.currentPlayer = player;
 }
Пример #3
0
 private GameState( GameBoard initialBoard, Player initialPlayer )
     : this(CreateInitialState( initialBoard, initialPlayer ))
 {
     // NOP
 }
Пример #4
0
 public GameOver( ICell<State> state, GameBoard board )
     : base(state, board)
 {
 }
Пример #5
0
        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;
            }
        }
Пример #6
0
 public bool Equals( GameBoard gameBoard )
 {
     return this.grid.Equals( gameBoard.grid );
 }