Ejemplo n.º 1
0
        public void CannotStep_WhenDone()
        {
            var env = new RandomWalkEnvironment(5, 4);

            env.DebugStep(1);

            // act & assert
            Assert.Throws <InvalidOperationException>(() => env.DebugStep(1));
            Assert.Throws <InvalidOperationException>(() => env.DebugStep(-1));
        }
Ejemplo n.º 2
0
        public void WhenStartingAtLeftmostPosition_StepLeft_Loses()
        {
            var env = new RandomWalkEnvironment(5, 0);

            var(_, reward, isDone) = env.DebugStep(-1);

            Assert.AreEqual(0, reward);
            Assert.True(isDone);
        }
Ejemplo n.º 3
0
        public void WhenStartingAtRightmostPosition_StepRight_Wins()
        {
            var env = new RandomWalkEnvironment(5, 4);

            var(_, reward, isDone) = env.DebugStep(1);

            Assert.AreEqual(1, reward);
            Assert.True(isDone);
        }
Ejemplo n.º 4
0
        public void WhenStartingInMiddle_StepRight_IncrementsPosition()
        {
            var env = new RandomWalkEnvironment(5, 3);

            var(state, reward, isDone) = env.DebugStep(1);

            Assert.AreEqual(4, state);
            Assert.AreEqual(0, reward);
            Assert.False(isDone);
        }