예제 #1
0
        public void GetMinimumValue_WithTerminalState_ReturnsUtilityValue()
        {
            var objectUnderTest = new MinimaxAlgorithm <float>(
                new GenericGameDescription <float>(
                    o => true,
                    o => o,
                    o => Enumerable.Empty <IMove <float> >()));

            float result = objectUnderTest.GetMinimumValue(4.0f).Value;

            result.Should().BeApproximately(4.0f, float.Epsilon);
        }
예제 #2
0
        public void GetMinimumValue_WithNonTerminalState_ReturnsMinimumValueOfSuccessorState()
        {
            var objectUnderTest = new MinimaxAlgorithm <float>(
                new GenericGameDescription <float>(
                    o => o >= 1.0,
                    o => o,
                    o => new IMove <float>[]
            {
                new FloatMove(6.0f),
                new FloatMove(3.0f),
                new FloatMove(7.0f),
                new FloatMove(1.2f)
            }));

            float result = objectUnderTest.GetMinimumValue(.0f).Value;

            result.Should().BeApproximately(1.2f, float.Epsilon);
        }