/// <summary> /// Initialize a new instance of the HangmanSix.CheckManager class /// </summary> /// <param name="player"></param> public CheckManager(Player player) { this.Player = player; this.CommandManager = new CommandManager(); this.HasHelpUsed = false; this.UsedLetters = new HashSet<char>(); }
public GameEngine(Player player, IConsole consoleWrapper) { this.Player = player; this.ConsoleWrapper = consoleWrapper; this.ChoiceStrategy = new ChoiceRandom(); this.PathToSecretWordsDirectory = PathToSecretWordsDatabase; }
public void AddScore(Player player) { this.TopScores.Add(player.Name, player.AttemptsToGuess); ExtractSpecificTopScores(); }
public void Update(Player player) { this.Load(); if (this.TopScores.Count < NumberOfTopScores || player.AttemptsToGuess < this.TopScores.Values.Last()) { while (true) { UIMessages.EnterPlayerNameMessage(); player.Name = this.ConsoleWrapper.ReadLine(); if (player.Name == string.Empty) { throw new ArgumentException("The player's name cannot be an empty strig!"); } else if (this.TopScores.ContainsKey(player.Name)) { throw new ArgumentException("Existing name!"); } break; } this.AddScore(player); this.Save(); } }