Esempio n. 1
0
 /// <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>();
 }
Esempio n. 2
0
 public GameEngine(Player player, IConsole consoleWrapper)
 {
     this.Player = player;
     this.ConsoleWrapper = consoleWrapper;
     this.ChoiceStrategy = new ChoiceRandom();
     this.PathToSecretWordsDirectory = PathToSecretWordsDatabase;
 }
Esempio n. 3
0
 public void AddScore(Player player)
 {
     this.TopScores.Add(player.Name, player.AttemptsToGuess);
     ExtractSpecificTopScores();
 }
Esempio n. 4
0
        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();
            }
        }