This is a console dice game where the player and the computer take turns rolling dice and comparing results. The game includes the generation of random numbers for fair rolls using HMAC, as well as a probability table for different dice throws.
The game involves two players: the computer and the human player. Players take turns selecting dice and rolling them. To ensure fairness, each roll is generated based on random numbers using the cryptographic function HMAC. The results of the rolls are compared, and the winner is determined by the highest result.
Main stages of the game:
- Players select their dice.
- To determine who goes first, a random number is generated for both the computer and the player.
- Both players then take turns rolling their selected dice.
- The results are compared, and the winner is announced based on the higher roll.
Game.cs
: The main game logic that controls the entire gameplay process.Interfaces/
: Interfaces used for implementing console output and random number generation services.Models/
: Data models, includingDiceModel
, that describe the dice.Services/
: Logic for handling probabilities, random number generation, and ensuring fair dice rolls.Utils/
: Helper classes like the menu, probability table, and random number generator.Program.cs
: The entry point of the application.
The project uses the following dependencies:
- Spectre.Console: A library for rendering styled and structured console output.
To run the project, follow these steps:
-
Clone the repository:
git clone https://github.com/Viorbrint/dice-game
-
Navigate to the project folder:
cd dice-game
-
Restore dependencies:
dotnet restore
-
Build and run the project:
dotnet run