コード例 #1
0
        //
        // Creates a new Board object by copying an existing one.
        //
        public Game_Othello_Board(Game_Othello_Board board)
        {
            // Create the squares and map.
            this.squares   = new int[8, 8];
            this.safeDiscs = new bool[8, 8];

            // Copy the given board.
            int i, j;

            for (i = 0; i < 8; i++)
            {
                for (j = 0; j < 8; j++)
                {
                    this.squares[i, j]   = board.squares[i, j];
                    this.safeDiscs[i, j] = board.safeDiscs[i, j];
                }
            }

            // Copy the counts.
            this.blackCount     = board.blackCount;
            this.whiteCount     = board.whiteCount;
            this.emptyCount     = board.emptyCount;
            this.blackSafeCount = board.blackSafeCount;
            this.whiteSafeCount = board.whiteSafeCount;
        }
コード例 #2
0
 public Game_Othello()
 {
     gameBoard           = new int[cols, rows];
     gameType            = "othello";
     maxPlayers          = 2;
     currentColor        = Game_Othello_Board.White; //STARTS with white
     board               = new Game_Othello_Board();
     state               = GameState.InPlayerMove;
     currentStringOutput = "";
 }