Exemplo n.º 1
0
 public static WinnersList getInstance()
 {
     if (instance == null)
     {
         instance = new WinnersList();
     }
     return(instance);
 }
Exemplo n.º 2
0
        public bool wasCorrectlyAnswered()
        {
            if (inPenaltyBox[currentPlayer])
            {
                if (isGettingOutOfPenaltyBox)
                {
                    Console.WriteLine("Answer was correct!!!!");
                    purses[currentPlayer]++;
                    Console.WriteLine(players[currentPlayer]
                                      + " now has "
                                      + purses[currentPlayer]
                                      + " Gold Coins.");

                    bool winner = didPlayerWin();
                    currentPlayer++;
                    if (currentPlayer == players.Count)
                    {
                        currentPlayer = 0;
                    }

                    if (winner)
                    {
                        WinnersList.getInstance().add((String)players[currentPlayer]);
                        if (WinnersList.getInstance().getWinnings((String)players[currentPlayer]) > 3)
                        {
                            Console.WriteLine(players[currentPlayer] + " is a champ!!!!");
                        }
                    }
                    return(winner);
                }
                else
                {
                    currentPlayer++;
                    if (currentPlayer == players.Count)
                    {
                        currentPlayer = 0;
                    }
                    return(true);
                }
            }
            else
            {
                Console.WriteLine("Answer was correct!!!!");
                purses[currentPlayer]++;
                Console.WriteLine(players[currentPlayer]
                                  + " now has "
                                  + purses[currentPlayer]
                                  + " Gold Coins.");

                bool winner = didPlayerWin();
                currentPlayer++;
                if (currentPlayer == players.Count)
                {
                    currentPlayer = 0;
                }

                if (winner)
                {
                    WinnersList.getInstance().add((String)players[currentPlayer]);
                    if (WinnersList.getInstance().getWinnings((String)players[currentPlayer]) > 3)
                    {
                        Console.WriteLine(players[currentPlayer] + " is a champ!!!!");
                    }
                }
                return(winner);
            }
        }