Beispiel #1
0
        public void Test07()
        {
            GameState gameState = TestCases.Test07();

            var move = this.brain.Move(gameState);

            Assert.That(move, Is.EqualTo(LegalMove.Right));
        }
Beispiel #2
0
        public string Test06(int hp)
        {
            GameState gameState = TestCases.Test06();

            gameState.You.Health = hp;

            var move = this.brain.Move(gameState);

            return(move.Move);
        }
Beispiel #3
0
        public string Test09(bool includeFood)
        {
            GameState gameState = TestCases.Test09(includeFood);

            gameState.You.Health = 50;

            var move = this.brain.Move(gameState);

            return(move.Move);
        }
        public void Test02()
        {
            var gameState = TestCases.Test02();

            var stopwatch = Stopwatch.StartNew();
            var move      = this.brain.Move(gameState);

            Console.WriteLine(stopwatch.Elapsed);

            Assert.That(move, Is.EqualTo(LegalMove.Left));
        }
Beispiel #5
0
        public void ProcessMoves_MoveIntoUpperWallWithFullHealth_SnakeGetsZeroHealth()
        {
            var board = TestCases.Test01().Board;

            int[,] boardArray = GetBoardArray(board);
            var snakeBodies = GetSnakeBodies(board);
            var healths     = GetHealths(board);

            var moves = new LegalMove[] { LegalMove.Up };

            (var futureSnakes, var futureHealths) = this.gameEngine.ProcessMoves(snakeBodies, healths, boardArray, moves);

            Assert.That(futureHealths[0], Is.EqualTo(0));
        }
Beispiel #6
0
        public void ProcessMoves_HeadOnCollisionWithFullHealth_ShortestSnakeGetsZeroHealth()
        {
            var board = TestCases.Test04().Board;

            int[,] boardArray = GetBoardArray(board);
            var snakeBodies = GetSnakeBodies(board);
            var healths     = GetHealths(board);

            var moves = new LegalMove[] { LegalMove.Right, LegalMove.Up };

            (var futureSnakes, var futureHealths) = this.gameEngine.ProcessMoves(snakeBodies, healths, boardArray, moves);

            Assert.That(futureHealths[0], Is.EqualTo(100));
            Assert.That(futureHealths[1], Is.EqualTo(0));
        }