The "Game of Dice" is a multiplayer game where N players roll a 6 faced dice in a round-robin fashion. Each time a player rolls the dice their points increase by the number (1 to 6) achieved by the roll.
As soon as a player accumulates M points they complete the game and are assigned a rank. Remaining players continue to play the game till they accumulate at least M points. The game ends when all players have accumulated at least M points.
- The order in which the users roll the dice is decided randomly at the start of the game.
- If a player rolls the value "6" then they immediately get another chance to roll again and move ahead in the game.
- If a player rolls the value "1" two consecutive times then they are forced to skip their next turn as a penalty.
The current code is a simple python program that can be easily run through command line interface.
git clone https://github.com/ombharatiya/game-of-dice.git
cd game-of-dice
python Game/Game.py test
Note: Currently only one test has been added
It takes two arguments: numof players & target score
python Game/Game.py 2 25
If you're having any issue, just try to run the Game.py file
python your/path/to/Game.py
And you'll get further instructions to run the program on Command line.
- Project uses Python Programming Language - This folder can be easily used in any Django/Flask application for any business logic implementation with correct views and fewer modifications
- The code uses Count Sort for printing the Score Board at every game pass
- The
GamePlay
is the main class for Game Play Implementations Player
is the class for Player and Their Score ImplementationsScoreBoard
is the class for Score Board related ImplementationsDice
is the class for Dice functionality & faces ImplementationsCustomException
is the class for handling any customised Exception baaed on various parametersTestGamePlay
is the class for running Unit tests on the whole program- Most of the identifiers & variables have self-explanatory names
Note: One example output has been saved in example.txt
- Om Bharatiya Om Bharatiya