예제 #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;
        }
예제 #2
0
파일: Rules.cs 프로젝트: kparkov/Formation
 // This is wrong! Any move is considered valid!
 public bool IsValidMove(GameState gameState, Move move)
 {
     return true;
 }
예제 #3
0
파일: Rules.cs 프로젝트: kparkov/Formation
 // This is wrong! Any game state is currently considered legal!
 public bool IsLegalGameState(GameState gameState)
 {
     return true;
 }
예제 #4
0
파일: Rules.cs 프로젝트: kparkov/Formation
 // This is wrong! Given a state, the given move options are always empty!
 public List<Move> GetOptions(GameState state)
 {
     return new List<Move>();
 }
예제 #5
0
파일: Rules.cs 프로젝트: kparkov/Formation
 // This is correct! But none of the ApplyMove calls are... :-(
 public GameState GetNewStateAfterMove(GameState currentState, Move move)
 {
     return move.ApplyMove(currentState);
 }