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 TestPlayKingMoveUpRight()
 {
     Game game = new Game();
     bool result = game.PlayKingMove('U', 'R');
     bool expected = true;
     Assert.AreEqual(expected, result);
 }
Esempio n. 3
0
 public void TestPlayKingMoveDownRight()
 {
     Game game = new Game();
     bool result = game.PlayKingMove('D', 'R');
     bool expected = false;
     Assert.AreEqual(expected, result);
 }