예제 #1
0
        public void AbWithDepth1_IsSameAsGreedy(string input)
        {
            var state            = StateReader.Read(input);
            var initialStateDump = state.ToString();

            var greedyAction = new GreedyAi(evaluator).GetAction(state, 100);
            var abAction     = new AlphabetaAi(evaluator, 1).GetAction(state, 100);

            Console.WriteLine(state.ToString());
            Console.WriteLine(abAction);

            state.ToString().Should().Be(initialStateDump, "ai.GetAction should not change state");
            abAction.ToString().Should().Be(greedyAction.ToString(), "ab-ai with depth=1 should be exactly gready ai");
        }
        public void BeEquivalentToGreedy_WhenSearchDepthIs1(string input)
        {
            var state            = StateReader.Read(input);
            var initialStateDump = state.ToString();

            var greedyAction = new GreedyAi(evaluator).GetAction(state, 100);
            var abAction     = new AlphaBetaAi(evaluator, 1).GetAction(state, 100);

            Console.WriteLine(state.ToString());
            Console.WriteLine($"[{abAction}]");

            state.ToString().Should().Be(initialStateDump, "ai.GetAction should not change state");
            abAction.ToString().Should().Be(greedyAction.ToString(), "ab-ai with depth=1 should be exactly gready ai");
        }