Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Roulette_Game/Program.cs
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
36 lines (30 sloc)
1.3 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
// Set the initial balance for the game | |
int initialBalance = 1000; | |
// Initialize game components | |
GameRules gameRules = new GameRules(); // Object to define the rules of the game | |
RoundHistory roundHistory = new RoundHistory(); // Object to keep track of round history | |
ResultDisplay resultDisplay = new ResultDisplay(); // Object to display game results | |
// Initialize the game manager with the provided initial balance, game rules, round history, and result display | |
GameManager gameManager = new GameManager(initialBalance, gameRules, roundHistory, resultDisplay); | |
// Main game loop | |
while (true) | |
{ | |
// Play a round of the game | |
gameManager.PlayRound(); | |
// Ask the user if they want to play again | |
Console.Write("Do you want to play again? (y/n): "); | |
string playAgain = Console.ReadLine(); | |
// If the user doesn't want to play again, exit the loop | |
if (playAgain.ToLower() != "y") | |
{ | |
break; | |
} | |
} | |
// Display game history after the game is over | |
gameManager.DisplayHistory(); | |
} | |
} |