コード例 #1
0
ファイル: MinimaxTest.cs プロジェクト: AnthonySteele/Hex
        public void TestCalculateMove3PathLength()
        {
            HexBoard board = new HexBoard(5);
            PlayFourMoves(board);

            // test score at this point
            PathLengthLoop pathLength = new PathLengthLoop(board);
            int playerScore = pathLength.PlayerScore(true);
            Assert.AreEqual(3, playerScore);

            playerScore = pathLength.PlayerScore(false);
            Assert.AreEqual(3, playerScore);

            // no advantage
            int moveScore = pathLength.SituationScore();
            Assert.AreEqual(moveScore, 0);
        }
コード例 #2
0
ファイル: Minimax3By3Test.cs プロジェクト: AnthonySteele/Hex
        public void TestCalculateMove2Situation()
        {
            HexBoard board = new HexBoard(3);
            PlayTwoMoves(board);

            // test score at this point
            PathLengthLoop pathLength = new PathLengthLoop(board);
            int playerScoreX = pathLength.PlayerScore(true);
            Assert.AreEqual(2, playerScoreX, "playerScoreX");

            int playerScoreY = pathLength.PlayerScore(false);
            Assert.AreEqual(2, playerScoreY, "playerScoreY");

            // no advantage
            int moveScore = pathLength.SituationScore();
            Assert.AreEqual(0, moveScore, "moveScore");
        }
コード例 #3
0
ファイル: Minimax3By3Test.cs プロジェクト: AnthonySteele/Hex
        public void TestCalculateMove2SituationScoreMiddle()
        {
            HexBoard board = new HexBoard(3);
            PlayTwoMoves(board);

            // playing middle gets adavantage
            board.PlayMove(1, 1, true);

            PathLengthLoop pathLength = new PathLengthLoop(board);
            int moveScore = pathLength.SituationScore();
            Assert.AreEqual(1, moveScore);

            board.GetCellAt(1, 1).IsOccupied = Occupied.PlayerY;
            moveScore = pathLength.SituationScore();
            Assert.AreEqual(-1, moveScore);

            board.GetCellAt(1, 1).IsOccupied = Occupied.Empty;
        }