Ejemplo n.º 1
0
        public void Test_Board_GameStatus_OWon()
        {
            var boardString = "XXX|OOO|.XX|OXX|O..|OOO|OXO|..O|.OO|OXX|OOO|XOO|XXX|OX.|.XX|.O.|O..|OO.|O..|OOO|.OX|XXX|...|...|..O|XXO|XXX";
            var macroboard  = "TOO|XOT|XOX";
            var board       = new UltimateBoard();

            board.ParseFromString(boardString);
            board.ParseMacroboardFromString(macroboard);

            // Tie
            Assert.IsTrue(board.GetGameStatus() == UltimateBoard.GameStatus.OWon);
        }
Ejemplo n.º 2
0
        public void Test_Board_GameStatus_MoreMovesAvailable()
        {
            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 macroboard  = "TXO|XOA|XOX";
            var board       = new UltimateBoard();

            board.ParseFromString(boardString);
            board.ParseMacroboardFromString(macroboard);

            // More moves available in center-right of microboard
            Assert.IsTrue(board.GetGameStatus() == UltimateBoard.GameStatus.MovesAvailable);
        }
Ejemplo n.º 3
0
        public void Test_Board_IsActiveMicroboard()
        {
            var board      = new UltimateBoard();
            var macroboard = "A..|...|...";

            board.ParseMacroboardFromString(macroboard);

            for (int y = 0; y < Field.Rows; y++)
            {
                for (int x = 0; x < Field.Cols; x++)
                {
                    if (x >= 0 && x <= 2 && y >= 0 && y <= 2)
                    {
                        Assert.IsTrue(board.IsActiveMicroboard(x, y));
                    }
                    else
                    {
                        Assert.IsFalse(board.IsActiveMicroboard(x, y),
                                       "Should be false for microboard [" + x + "," + y + "]");
                    }
                }
            }
        }