AddToGame() public method

public AddToGame ( AbstractGame game, PlayerType playerType ) : void
game AbstractGame
playerType PlayerType
return void
コード例 #1
0
 public void TestMethodLevel0()
 {
     var abs = new AlphaBetaSearch();
     IState state = new TestState(0);
     abs.AddToGame(new TestGame(), PlayerType.PlayerOne);
     AbstractStep step = abs.MakeDecision(state);
     Assert.AreEqual(null, step);
 }
コード例 #2
0
        public void TestMethodLevel1()
        {
            var abs = new AlphaBetaSearch(2);
            var state = new TestState(1);
            var left = new TestState(4);
            var right = new TestState(3);
            state.AddChilds(left, right);

            abs.AddToGame(new TestGame(), PlayerType.PlayerOne);
            AbstractStep step = abs.MakeDecision(state);
            var result = (TestState) ((TestStep) step).GetState();
            Assert.AreEqual(4, result.GetHValue());
            Assert.AreEqual(left, result);
        }
コード例 #3
0
        public void TestMethodLevel2()
        {
            var abs = new AlphaBetaSearch(4);

            var state = new TestState(0);
            var level1_0 = new TestState(0);
            var level1_1 = new TestState(0);
            var level2_0 = new TestState(2);
            var level2_1 = new TestState(7);
            var level2_2 = new TestState(1);
            var level2_3 = new TestState(8);
            state.AddChilds(level1_0, level1_1);
            level1_0.AddChilds(level2_0, level2_1);
            level1_1.AddChilds(level2_2, level2_3);

            abs.AddToGame(new TestGame(), PlayerType.PlayerOne);
            AbstractStep step = abs.MakeDecision(state);
            var result = (TestState) ((TestStep) step).GetState();
            Assert.AreEqual(level1_0, result);
        }