public void TestValidateCommandEmptyString() { Game game = new Game(); game.MovesCount = 2; bool result = game.ValidateCommand(string.Empty); Assert.AreEqual(false, result); }
public void TestValidateCommandInvalidPawnCommand() { Game game = new Game(); game.MovesCount = 1; bool result = game.ValidateCommand("SL"); Assert.AreEqual(false, result); }
public void TestValidateCommandValidKingInputUpRight() { Game game = new Game(); game.MovesCount = 2; bool result = game.ValidateCommand("KUR"); Assert.AreEqual(true, result); }
public void TestValidateCommandValidDPawnCommand() { Game game = new Game(); game.MovesCount = 1; bool result = game.ValidateCommand("DL"); Assert.AreEqual(true, result); }
public void TestValidateCommandPawnCommandEmptyString() { Game game = new Game(); game.MovesCount = 1; bool result = game.ValidateCommand(string.Empty); }
public void TestValidateCommandKingInputInvalidCommand() { Game game = new Game(); game.MovesCount = 2; bool result = game.ValidateCommand("KFC"); Assert.AreEqual(false, result); }
public static void Main() { Game game = new Game(); while (!game.GameIsFinished) { Console.Clear(); Console.SetCursorPosition(0, 0); Console.WriteLine(game.GetGridAsString()); string message; message = game.KingIsOnTheMove ? "Please enter king's turn: " : "Please enter pawn's turn: "; while (true) { Console.Write(message); string userInput = GetUserInput(); if (userInput == string.Empty) { Console.WriteLine("Please enter something!"); continue; } if (game.ValidateCommand(userInput)) { if (ExecuteCommand(userInput, game)) { break; } else { if (game.CheckIfAllPawnsAreStuck()) { Console.WriteLine("King wins!"); } else if (game.CheckIfKingIsStuck()) { Console.WriteLine("King loses!"); } else { Console.WriteLine("You can't go in this direction! "); } } } else { Console.WriteLine("Illegal move!"); } } if (game.CheckIfKingExited()) { Console.WriteLine("End!"); Console.WriteLine("King wins in {0} moves!", game.KingTurns); break; } } Console.WriteLine("Game is finished!"); Console.WriteLine("\nThank you for using this game!\n\n"); }