Exemple #1
0
        public GameState NewBoard()
        {
            var state = new GameState();

            state.WhiteCells = new List<GameBoardCell>() {new Die(), new Die(), new Die(), new Die(), new Die() };
            state.BlackCells = new List<GameBoardCell>() {new Die(), new Die(), new Die(), new Die(), new Die() };

            state.WhiteCells = state.WhiteCells.OfType<Die>().OrderByDescending(x => x.Value).Cast<GameBoardCell>().ToList();
            state.BlackCells = state.BlackCells.OfType<Die>().OrderByDescending(x => x.Value).Cast<GameBoardCell>().ToList();

            state.WhiteCells.Add(new GameBoardCell());
            state.WhiteCells.Add(new GameBoardCell());
            state.WhiteCells = state.WhiteCells.Reverse().ToList();
            state.WhiteCells.Add(new GameBoardCell());
            state.WhiteCells = state.WhiteCells.Reverse().ToList();

            return state;
        }
Exemple #2
0
 // This is wrong! Any move is considered valid!
 public bool IsValidMove(GameState gameState, Move move)
 {
     return true;
 }
Exemple #3
0
 // This is wrong! Any game state is currently considered legal!
 public bool IsLegalGameState(GameState gameState)
 {
     return true;
 }
Exemple #4
0
 // This is wrong! Given a state, the given move options are always empty!
 public List<Move> GetOptions(GameState state)
 {
     return new List<Move>();
 }
Exemple #5
0
 // This is correct! But none of the ApplyMove calls are... :-(
 public GameState GetNewStateAfterMove(GameState currentState, Move move)
 {
     return move.ApplyMove(currentState);
 }