示例#1
0
        public void Test_Board_MakeMove_OccupiedPosition()
        {
            var boardString = "XOX|XXX|.XX|OXX|O..|OOO|OXO|..O|.OO|OXX|OOO|XOO|XXX|OX.|.XX|.O.|O..|OO.|O..|OOO|.OX|XXX|...|...|..O|XXO|XXX";
            var board       = new UltimateBoard();

            board.ParseFromString(boardString);

            // This position is occupied
            var move = new Move(1, 0);

            board.MakeMove(move, UltimateBoard.PlayerX);
        }
示例#2
0
        public void Test_Board_MakeMove_TieMove()
        {
            var boardString = "X.X|XXX|.XX|OXX|O..|OOO|OXO|..O|.OO|OXX|OOO|XOO|XXX|OX.|.XX|.O.|O..|OO.|O..|OOO|.OX|XXX|...|...|..O|XXO|XXX";
            var board       = new UltimateBoard();

            board.ParseFromString(boardString);

            // Tie the upper-left corner of microboard
            var move = new Move(1, 0);

            board.MakeMove(move, UltimateBoard.PlayerO);
            Assert.IsTrue(board.Macroboard[0, 0] == UltimateBoard.Tied);
        }
示例#3
0
        public void Test_Board_MakeMove_PlayerXWins()
        {
            // Make winning move in upper-left microboard
            var boardString = "X.X|XXX|.XX|OXX|O..|OOO|OXO|..O|.OO|OXX|OOO|XOO|XXX|OX.|.XX|.O.|O..|OO.|O..|OOO|.OX|XXX|...|...|..O|XXO|XXX";
            var board       = new UltimateBoard();

            board.ParseFromString(boardString);

            // Win the microboard
            var move = new Move(1, 0);

            board.MakeMove(move, UltimateBoard.PlayerX);

            // X won upper-left corner of macroboard
            Assert.IsTrue(board.Macroboard[0, 0] == UltimateBoard.PlayerX);
        }