コード例 #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;
        }
コード例 #2
0
        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);
        }
コード例 #3
0
ファイル: Game.cs プロジェクト: MSPR-INTCONT/suicide-sprints
        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);
        }
コード例 #4
0
ファイル: Game.cs プロジェクト: MSPR-INTCONT/suicide-sprints
        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);
        }
コード例 #5
0
ファイル: Game.cs プロジェクト: MSPR-INTCONT/suicide-sprints
        public void WrongAnswer()
        {
            if (_maxAmountOfPrisoners != 0)
            {
                _prisoners.Enqueue(CurrentPlayer);
            }

            CurrentPlayer.InPenaltyBox = true;
            CurrentPlayer.WinStreak    = 1;
            WrongAnswerText();

            if (_maxAmountOfPrisoners != 0)
            {
                if (_prisoners.Count > _maxAmountOfPrisoners)
                {
                    Player prisoner = _prisoners.Dequeue();
                    prisoner.InPenaltyBox = false;
                    prisoner.WinStreak    = 1;
                    Console.WriteLine($"prison is full : {prisoner} is getting out of penalty box");
                }
            }

            _choosenCategoryName = InputUtilities.AskChoices("Select question category for next player", _categories);
        }
コード例 #6
0
 public void AskForSeed()
 {
     Seed = InputUtilities.AskForNumber("What is the seed ?", Int32.MinValue);
 }
コード例 #7
0
 public void AskMaxAmountOfPrisoners()
 {
     MaxAmountOfPrisoners =
         InputUtilities.AskForNumberWithMaxValue("How much prisoners maximum ?", Players.Count - 1);
 }
コード例 #8
0
 public void AskGoldNumberToWin()
 {
     CoinsToWin = InputUtilities.AskForNumber("How much coins to win ?", 6);
 }
コード例 #9
0
ファイル: Game.cs プロジェクト: MSPR-INTCONT/suicide-sprints
 public void Answer(float percent, bool?isCorrectAnswer = null)
 {
     InputUtilities.AskSuccess(isCorrectAnswer ?? _rng.NextDouble() <= percent, CorrectAnswer, WrongAnswer);
 }