private static void RecordPlayerShot(PlayerModel activePlayer, PlayerModel opponent) { bool isValidShot = false; string row = ""; int column = 0; do { string shot = AskForShot(activePlayer); try { (row, column) = GameLogic.SplitShotIntoRowAndColumn(shot); isValidShot = GameLogic.ValidateShot(activePlayer, row, column); } catch (Exception) { // Console.WriteLine("This was not a valid Shot.Please try again"); isValidShot = false; } if (isValidShot == false) { Console.WriteLine("Invalid shot. Please try again"); } } while (isValidShot == false); bool isAHit = GameLogic.IdentifyShotResult(opponent, row, column); GameLogic.MarkShotResult(activePlayer, row, column, isAHit); DysplayShotResut(row, column, isAHit); }
private static void RecordPlayerShot(PlayerInfoModel activePlayer, PlayerInfoModel opponent) { bool isValidShot = false; string row = ""; int column = 0; do { //Ask for a shot i.e. "B2" not "B" "2" string shot = AskForShot(); //Determine what row and column (row, column) = GameLogic.SplitShotIntoRowAndColumn(shot); isValidShot = GameLogic.ValidateSpot(activePlayer, row, column); if (isValidShot == false) { Console.WriteLine("Invalid shot location. Try again."); } } while (isValidShot == false); bool isAHit = GameLogic.IdentifyShotResult(opponent, row, column); GameLogic.MarkShotResult(activePlayer, row, column, isAHit); }
private static void RecordPlayerShot(PlayerInfoModel player1, PlayerInfoModel player2) { bool isValidShot = false; string row = ""; int column = 0; do { string shot = AskForShot(player1); (row, column) = GameLogic.SplitShotInfo(shot); isValidShot = GameLogic.ValidateShot(player1, row, column); if (!isValidShot) { Console.WriteLine("Invalid shot location, try again"); } } while (!isValidShot); bool isHit = GameLogic.IdenfityShotResult(player2, row, column); GameLogic.MarkShotResult(player1, row, column, isHit); DisplayShotGridResults(row, column, isHit); }