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); }
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); }
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); }
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); }
public void AskForSeed() { Seed = InputUtilities.AskForNumber("What is the seed ?", Int32.MinValue); }
public void AskMaxAmountOfPrisoners() { MaxAmountOfPrisoners = InputUtilities.AskForNumberWithMaxValue("How much prisoners maximum ?", Players.Count - 1); }
public void AskGoldNumberToWin() { CoinsToWin = InputUtilities.AskForNumber("How much coins to win ?", 6); }
public void Answer(float percent, bool?isCorrectAnswer = null) { InputUtilities.AskSuccess(isCorrectAnswer ?? _rng.NextDouble() <= percent, CorrectAnswer, WrongAnswer); }