Exemple #1
0
        public void Test_PlacePenguin_getFishNearEmpty()
        {
            // Init game
            CustomGame customGame = InitGame(null);

            // Init AI Hard
            AIHard aiHard = new AIHard(customGame.Board, new AppRandom(), customGame.CurrentPlayer);
            IList <Coordinates> fishThreePointsList = new List <Coordinates>();

            // Set cell origin with three points
            Cell cellThreePoints = (Cell)customGame.Board.Board[1, 1];

            cellThreePoints.FishCount = 3;
            Coordinates coordinates = new Coordinates(1, 1);

            // Set others cells
            SetFish(customGame);

            // Add cell with 3 points to the list
            fishThreePointsList.Add(coordinates);

            // Launch function
            IList <Coordinates> list = aiHard.GetFishNear(fishThreePointsList);

            // Test
            Assert.IsTrue(list.Count == 0);
        }
Exemple #2
0
        public void Test_PlacePenguin_getFishNear()
        {
            // Init Game
            CustomGame customGame = InitGame(null);

            // Init AI Hard
            AIHard aiHard = new AIHard(customGame.Board, new AppRandom(), customGame.CurrentPlayer);
            IList <Coordinates> fishThreePointsList = new List <Coordinates>();

            // Set origin cell with 3 points
            Cell cellThreePoints = (Cell)customGame.Board.Board[1, 1];

            cellThreePoints.FishCount = 3;
            Coordinates coordinates = new Coordinates(1, 1);

            // Set up right cell of the origin cell
            Cell cellUpRight = (Cell)customGame.Board.Board[2, 0];

            cellUpRight.FishCount = 1;

            // Set right cell of the origin cell
            Cell cellRight = (Cell)customGame.Board.Board[2, 1];

            cellRight.FishCount = 1;

            // Set down right cell of the origin cell
            Cell cellDownRight = (Cell)customGame.Board.Board[2, 2];

            cellDownRight.FishCount = 1;

            // Set down left cell of the origin cell
            Cell cellDownLeft = (Cell)customGame.Board.Board[1, 2];

            cellDownLeft.FishCount = 1;

            // Set left cell of the origin cell
            Cell cellLeft = (Cell)customGame.Board.Board[0, 1];

            cellLeft.FishCount = 1;

            //Set up left cell of the origin cell
            Cell cellUpLeft = (Cell)customGame.Board.Board[1, 0];

            cellUpLeft.FishCount = 1;

            // Add cell with 3 points to the list
            fishThreePointsList.Add(coordinates);

            // Launch function
            IList <Coordinates> list = aiHard.GetFishNear(fishThreePointsList);

            // Test
            Assert.IsTrue(list[0].X == 0 && list[0].Y == 1);
            Assert.IsTrue(list[1].X == 2 && list[1].Y == 1);
            Assert.IsTrue(list[2].X == 1 && list[2].Y == 0);
            Assert.IsTrue(list[3].X == 2 && list[3].Y == 0);
            Assert.IsTrue(list[4].X == 1 && list[4].Y == 2);
            Assert.IsTrue(list[5].X == 2 && list[5].Y == 2);
        }