Esempio n. 1
0
 private void ProcessWin()
 {
     this.userInterface.WriteLine(Messege.WinMessege);
     this.PrintBoard();
     this.userInterface.WriteLine(Messege.EnterNameMessege);
     string name = this.userInterface.ReadLine();
     IPlayer player = new Player(name, this.counter);
     this.topPlayers.Add(player);
     this.PrintTopPlayers();
 }
Esempio n. 2
0
        private void ProcessDead()
        {
            this.PrintBoard();
            this.userInterface.Write(Messege.LoseMessege + Messege.EnterNameMessege, this.counter);
            string niknejm = this.userInterface.ReadLine();
            Player t = new Player(niknejm, this.counter);
            if (this.topPlayers.Count < 5)
            {
                this.topPlayers.Add(t);
            }
            else
            {
                for (int i = 0; i < this.topPlayers.Count; i++)
                {
                    if (this.topPlayers[i].Points < t.Points)
                    {
                        this.topPlayers.Insert(i, t);
                        this.topPlayers.RemoveAt(this.topPlayers.Count - 1);
                        break;
                    }
                }
            }

            this.topPlayers.Sort((r1, r2) => string.Compare(r2.Name, r1.Name, StringComparison.Ordinal));
            this.topPlayers.Sort((r1, r2) => r2.Points.CompareTo(r1.Points));
            this.PrintTopPlayers();
        }