write a program that simulates a game called Zanzibar. Zanzibar is an easy dice game that boomed
Question:
write a program that simulates a game called Zanzibar.
Zanzibar is an easy dice game that boomed in popularity within French pubs. Today, it is played all over the world and suitable for any number of players. The first player to rid themselves of all tokens wins!
What You'll Need:
- 2 or more Players
- Three Dice
- 20 Chips for Each Player
How to Play
The game begins after each player grabs 20 chips for themselves. The goal is to get rid of all your chips at the expense of other players.
Once you're all set, the first player may roll the dice three times to earn as high a score as possible through specific combinations. Here is a look at the combinations you'll want to roll:
- 4,5,6 - (Also known as a Zanzibar)
- 1,1,1
- 2,2,2
- 3,3,3
- 4,4,4
- 5,5,5
- 6,6,6
- 1,2,3
If you don't roll these combinations, no worries. You can also earn points by adding the sum of the three dice together.
- 1 = 100 points
- 6 = 60 points
- 2 = 2 points
- 3 = 3 points
- 4 = 4 points
- 5 = 5 points
As an example, if you throw a 1,4,5, you'll receive 109 points. Should you roll a 3,2,2, you'll earn 7 points.
Once the first player's turn has ended and they've calculated their score, the dice moves to the next player, who will attempt to roll a higher score within the same number of rolls than the first player. Once everyone has had their turn, the player with the lowest score must receive chips from everyone else. How many they gain will depend on the hand of the player with the highest score.
- 1 chip if the highest score is a points total
- 2 chips if the highest score is 1,2,3
- 3 chips if the highest score is three-of-a-kind
- 4 chips if the highest score is 4,5,6 (Zanzibar)
This will continue until one player has no chips remaining, which will deem them the winner.
You must use either a for loop or a while loop when rolling the dice after the point is established - you cannot just use if statements to accomplish the potential multiple rolls. You must also remember to incorporate functions into your code and should create the following functions:
- A function called Roll_Three_Dice to rolls the three dice.
- A function called Get_High_Score to call the function that rolls the dice and calculates the highest score for a player.
- A function called Determine_Round_Winner to handle all the tasks needed to decide which player won the round and if any player won the game. It also calls the trasfer chips function.
- A function called Transfer_Chips to handle the transfer of chips between the players.
You must only use Python tools we have covered in class or the textbook. However, for this assignment you are allowed to use the random function to help you roll the dice.
Principles Of Information Security
ISBN: 9780357506431
7th Edition
Authors: Michael E. Whitman, Herbert J. Mattord