Beispiel #1
0
        public void AskUseTechno()
        {
            bool useTechno = false;

            InputUtilities.AskQuestion("Do you want to replace Rock by Techno ?", new Dictionary <string, Action>
            {
                { "yes", () => useTechno = true },
                { "no", () => useTechno = false },
            });
            UseTechno = useTechno;
        }
        private static void MakeGame(List <string> players, int seed)
        {
            Config configGame = new Config(players);
            bool   newGame    = false;

            do
            {
                Game aGame = new Game(configGame);

                if (!aGame.IsPlayable())
                {
                    Console.WriteLine("Can't start Game");
                    return;
                }

                do
                {
                    aGame.StartTurnText();
                    if (!aGame.AskIfPlayerWantToLeaveGame())
                    {
                        aGame.TryRoll();
                        if (!aGame.AskForJokerUse())
                        {
                            aGame.Answer(false);
                        }
                    }
                    else if (!aGame.IsPlayable())
                    {
                        Console.WriteLine("Game Can't be played anymore");
                        break;
                    }

                    aGame.SelectNextPlayer();
                } while (!aGame.IsGameOver);

                aGame.DisplayLeaderboard();

                Console.WriteLine("\n\n");
                InputUtilities.AskQuestion("Do you want to play a new game ?", new Dictionary <string, Action>
                {
                    { "yes", () => newGame = true },
                    { "no", () => newGame = false }
                });
                Console.WriteLine("\n\n");
            } while (newGame);
        }
Beispiel #3
0
        public bool AskIfPlayerWantToLeaveGame()
        {
            bool quitGame = false;

            InputUtilities.AskQuestion("Do you want to quit game ?", new Dictionary <string, Action>
            {
                {
                    "yes", () =>
                    {
                        quitGame = true;
                        _players.Remove(CurrentPlayer);
                        SelectPreviousPlayer();
                    }
                },
                { "no", null }
            });
            return(quitGame);
        }
Beispiel #4
0
        public bool AskForJokerUse()
        {
            if (!CurrentPlayer.HasJoker)
            {
                return(false);
            }

            bool useJoker = false;

            InputUtilities.AskQuestion("Do you want to use a joker ?", new Dictionary <string, Action>
            {
                {
                    "yes", () =>
                    {
                        useJoker = true;
                        CurrentPlayer.HasJoker = false;
                    }
                },
                { "no", null }
            });
            return(useJoker);
        }