Esempio n. 1
0
        public static bool ExecuteCommand(string cmd, Game game)
        {
            char startLetter = cmd[0];
            int[] oldCoordinates = new int[2];
            int[] coords = new int[2];

            if (startLetter == 'K')
            {
                return game.PlayKingMove(cmd[1], cmd[2]);
            }
            else if (startLetter == 'A' || startLetter == 'B' || startLetter == 'C' || startLetter == 'D')
            {
                return game.PlayPawnMove(startLetter, cmd[1]);
            }
            else
            {
                throw new ArgumentException("Attempting to move a non existing figure!");
            }
        }
Esempio n. 2
0
 public void TestPlayPawnIsStuck()
 {
     Game game = new Game();
     game.PlayPawnMove('A', 'L');
     bool result = game.CheckIfAllPawnsAreStuck();
     bool expected = false;
     Assert.AreEqual(expected, result);
 }
Esempio n. 3
0
 public void TestPlayPawnDMoveRight()
 {
     Game game = new Game();
     bool result = game.PlayPawnMove('D', 'R');
     bool expected = true;
     Assert.AreEqual(expected, result);
 }
Esempio n. 4
0
 public void TestPlayPawnInvalidPawn()
 {
     Game game = new Game();
     game.PlayPawnMove('E', 'R');
 }
Esempio n. 5
0
 public void TestPlayPawnAMoveLeft()
 {
     Game game = new Game();
     bool result = game.PlayPawnMove('A', 'L');
     bool expected = false;
     Assert.AreEqual(expected, result);
 }