/// <summary> /// Prints on the console all the information the player needs after beating the game. /// Number of moves he made, the top score list and if the player was able to get on the top score list. /// </summary> /// <param name="game"> game instance </param> internal static void PrintFinalGameResult(Game game) { string moves = game.Turn == 1 ? "1 move" : string.Format("{0} moves", game.Turn); Console.WriteLine(Messages.CongratulationMessage(moves)); string[] topScores = TopScores.GetTopScoresFromFile(); if (topScores[TopScores.TOP_SCORES_AMOUNT - 1] != null) { string lowestScore = Regex.Replace(topScores[TopScores.TOP_SCORES_AMOUNT - 1], TopScores.TOP_SCORES_PERSON_PATTERN, @"$2"); if (int.Parse(lowestScore) < game.Turn) { Console.WriteLine(Messages.NoTopScoreAchieved(TopScores.TOP_SCORES_AMOUNT)); return; } } TopScores.UpgradeTopScore(game); }
internal static void PrintTopScores() { Console.Write(Messages.ScoreBoard()); string[] topScores = TopScores.GetTopScoresFromFile(); if (topScores[0] == null) { Console.WriteLine(Messages.NoTopScores()); } else { foreach (string score in topScores) { if (score != null) { Console.WriteLine(score); } } } }