コード例 #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!");
            }
        }
コード例 #2
0
ファイル: GameTests.cs プロジェクト: skolev/KingSurvival
 public void TestPlayKingMoveUpRight()
 {
     Game game = new Game();
     bool result = game.PlayKingMove('U', 'R');
     bool expected = true;
     Assert.AreEqual(expected, result);
 }
コード例 #3
0
ファイル: GameTests.cs プロジェクト: skolev/KingSurvival
 public void TestPlayKingMoveDownRight()
 {
     Game game = new Game();
     bool result = game.PlayKingMove('D', 'R');
     bool expected = false;
     Assert.AreEqual(expected, result);
 }