using System.Collections.Generic;
private bool inPenalityBox;
public Player(string playerName)
public bool InPenalityBox {
get { return inPenalityBox; }
set { inPenalityBox = value; }
public TriviaCategory Category()
return TriviaCategory.Pop;
return TriviaCategory.Science;
return TriviaCategory.Sports;
return TriviaCategory.Rock;
public string CategoryString()
private Random rndDie = new Random();
if(dieType == DieType.Six)
public int MaxDie { get { return maxDie; }}
public int MinDie { get { return minDie; }}
return rndDie.Next(minDie, maxDie + 1);
public enum TriviaCategory{
private LinkedList<string> popQuestions = new LinkedList<string>();
private LinkedList<string> scienceQuestions = new LinkedList<string>();
private LinkedList<string> sportsQuestions = new LinkedList<string>();
private LinkedList<string> rockQuestions = new LinkedList<string>();
for (int i = 0; i < 50; i++)
popQuestions.AddLast(string.Format("{0}",i));
scienceQuestions.AddLast(string.Format("{0}",i));
sportsQuestions.AddLast(string.Format("{0}",i));
rockQuestions.AddLast(string.Format("{0}",i));
public void askQuestion(TriviaCategory category)
string question = string.Empty;
if (category == TriviaCategory.Pop)
question = popQuestions.First();
popQuestions.RemoveFirst();
if (category == TriviaCategory.Science)
question = scienceQuestions.First();
scienceQuestions.RemoveFirst();
if (category == TriviaCategory.Science)
question = sportsQuestions.First();
sportsQuestions.RemoveFirst();
if (category == TriviaCategory.Rock)
question = rockQuestions.First();
rockQuestions.RemoveFirst();
Console.WriteLine(string.Format("{0} Question: {1}", category, question));
private Die die = new Die();
private int currentPlayer;
private bool isGettingOutOfPenaltyBox;
private List<Player> players = new List<Player>();
private Trivia trivia = new Trivia();
isGettingOutOfPenaltyBox = false;
return (howManyPlayers() >= 2 && howManyPlayers() <= maxPlayer);
public int howManyPlayers()
public bool add(String playerName)
players.Add(new Player(playerName));
Console.WriteLine(playerName + " was added");
Console.WriteLine("They are player number " + players.Count);
Console.WriteLine(players[currentPlayer].Name + " is the current player");
Console.WriteLine("They have rolled a " + roll);
if (players[currentPlayer].InPenalityBox == true)
isGettingOutOfPenaltyBox = true;
Console.WriteLine(players[currentPlayer].Name + " is getting out of the penalty box");
players[currentPlayer].Place = players[currentPlayer].Place + roll;
if (players[currentPlayer].Place > 11) players[currentPlayer].Place = players[currentPlayer].Place - 12;
Console.WriteLine(players[currentPlayer].Name
+ players[currentPlayer].Place);
Console.WriteLine("The category is " + players[currentPlayer].CategoryString());
trivia.askQuestion(players[currentPlayer].Category());
Console.WriteLine(players[currentPlayer].Name + " is not getting out of the penalty box");
isGettingOutOfPenaltyBox = false;
players[currentPlayer].Place = players[currentPlayer].Place + roll;
if (players[currentPlayer].Place > 11) players[currentPlayer].Place = players[currentPlayer].Place - 12;
Console.WriteLine(players[currentPlayer].Name
+ players[currentPlayer].Place);
Console.WriteLine("The category is " + players[currentPlayer].CategoryString());
trivia.askQuestion(players[currentPlayer].Category());
public bool wasCorrectlyAnswered()
if (players[currentPlayer].InPenalityBox == true)
if (isGettingOutOfPenaltyBox = true)
Console.WriteLine("Answer was correct!!!!");
players[currentPlayer].Purse++;
Console.WriteLine(players[currentPlayer]
+ players[currentPlayer].Purse
bool winner = didPlayerWin();
if (currentPlayer == players.Count) currentPlayer = 0;
if (currentPlayer == players.Count) currentPlayer = 0;
Console.WriteLine("Answer was corrent!!!!");
players[currentPlayer].Purse++;
Console.WriteLine(players[currentPlayer]
+ players[currentPlayer].Purse
bool winner = didPlayerWin();
if (currentPlayer == players.Count) currentPlayer = 0;
public bool wrongAnswer()
Console.WriteLine("Question was incorrectly answered");
Console.WriteLine(players[currentPlayer].Name + " was sent to the penalty box");
players[currentPlayer].InPenalityBox = true;
if (currentPlayer == players.Count) currentPlayer = 0;
private bool didPlayerWin()
return !(players[currentPlayer].Purse == 6);
private static bool notAWinner;
public static void Main(String[] args)
Random rand = new Random(1234);
notAWinner = game.wrongAnswer();
notAWinner = game.wasCorrectlyAnswered();