Ejemplo n.º 1
0
        private Boolean Turn(Player player)
        {
            ShowNewSite();

            Console.WriteLine("It's " + player.GetName() + "'s turn, press enter to roll");
            Console.ReadLine();

            int roll = dice.Roll();
            Console.WriteLine("Your roll is: " + roll);
            if (roll == DELETE_ROLL) {
                Console.WriteLine("You lost your score of " + player.GetTempScore());
                player.DeleteTempScore();
            } else {
                player.AddToTempScore(roll);
                Console.WriteLine("Your score: " + player.GetTempScore() + "]");

                if (IsWinner(player)) {
                    PrintWin();
                    return true;
                } else {
                    Console.Write("Press s to save your score");
                    if (Console.ReadKey().KeyChar == 's') {
                        player.SaveScore();
                        Console.WriteLine("------------- saved.");
                    } else {
                        Console.WriteLine("");
                    }
                }
            }
            return false;
        }
Ejemplo n.º 2
0
 private Boolean IsWinner(Player player)
 {
     return player.GetTempScore() >= WIN_SCORE;
 }