Beispiel #1
0
        private void InitPlayers()
        {
            Console.WriteLine("Please enter amount of players");
            amountofPlayers = Int32.Parse(Console.ReadLine());

            players = new Player[amountofPlayers];
            for (int i = 0; i < amountofPlayers; i++) {
                Console.WriteLine("Please enter name of player "+(i+1));
                Player player = new Player(Console.ReadLine());
                players[i] = player;
                Console.WriteLine("Welcome " + player.GetName());
                Console.WriteLine("");
            }
        }
Beispiel #2
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;
        }