You are required to implement a simple variant of Blackjack using dice. The game is played among several players, and the winner is the player who has the highest total dice value.
Your program must keep track of players’ name, points and dice values. You must use the collection type dict to store the players’ details as well as the collection of players. You may use list for any other collection.
Refer to the example runs. Your program must adhere to these guidelines:
• There must be a minimum of 3 players and a maximum of 5. Start by getting the names of 3 to 5 players. Players’ names must be unique.
• Each player starts with 2 points
• For each new game, randomly order the players, so that they roll the dice according to this order.
• Each game starts with each player rolling 2 dice.
Display the total for each player.
• Each player then takes turn to decide whether to roll a dice or to miss. If he rolls a dice, he can decide to keep rolling as long as the total is not 13 or more. Display the total for the player each time he rolls a dice.
• At the end of the game, the points for the players are adjusted as follows:
o Add 2 points to players with the highest total dice value that does not exceed 13. There can be more than one winner. o Deduct 2 points from players who bust, that is, their total dice value exceeds 13.
o Do not adjust the points for all other players.
o Display the game summary.
• The players can continue to play more games with their existing points as long as there is no player with 0 point or with 10 points. Two example runs are shown below:
Enter player name, to end:
Minimum 3 players please, currently only 0 player!
Enter player name, to end: A
Enter player name, to end: B
Enter player name, to end: C
Enter player name, to end: D
Enter player name, to end: E
5 Players playing
Playing in this order: (D, E, A, B, C)
Start game. Roll 2 dice per player
D, dice: (2, 6), total 8
E, dice: (4, 1), total 5
A, dice: (6, 6), total 12
B, dice: (2, 6), total 8
C, dice: (5, 1), total 6
D, roll or miss? (r/m)? r
D, dice: (2, 6, 4), total 12
D, roll or miss? (r/m)? m
E, roll or miss? (r/m)? r
E, dice: (4, 1, 4), total 9
E, roll or miss? (r/m)? r
E, dice: (4, 1, 4, 5), total 14. Bust!
A, roll or miss? (r/m)? m
B, roll or miss? (r/m)? m
C, roll or miss? (r/m)? m
D, dice: (2, 6, 4), total 12. Winner! Points: 2+2 = 4
E, dice: (4, 1, 4, 5), total 14. Bust! Points: 2-2 = 0 A, dice: (6, 6), total 12. Winner! Points: 2+2 = 4
B, dice: (2, 6), total 8. Points: 2
C, dice: (5, 1), total 6. Points: 2
Player bust. End game
Enter player name, to end: A
Enter player name, to end: B
Enter player name, to end: C
Enter player name, to end:
3 Players playing
Playing in this order: (B, C, A)
Start game. Roll 2 dice per player
B, dice: (1, 6), total 7
C, dice: (2, 2), total 4
A, dice: (1, 2), total 3
B, roll or miss? (r/m)? r
B, dice: (1, 6, 4), total 11
B, roll or miss? (r/m)? m
C, roll or miss? (r/m)? r
C, dice: (2, 2, 6), total 10
C, roll or miss? (r/m)? r
C, dice: (2, 2, 6, 3), total 13
A, roll or miss? (r/m)? r
A, dice: (1, 2, 4), total 7
A, roll or miss? (r/m)? r
A, dice: (1, 2, 4, 4), total 11 A, roll or miss? (r/m)? m
B, dice: (1, 6, 4), total 11. Points: 2
C, dice: (2, 2, 6, 3), total 13. Winner! Points: 2+2 = 4
A, dice: (1, 2, 4, 4), total 11. Points: 2
Continue next game (y/n)? y
Playing in this order: (C, A, B)
Start game. Roll 2 dice per player
C, dice: (1, 5), total 6
A, dice: (3, 5), total 8
B, dice: (2, 3), total 5
C, roll or miss? (r/m)? r
C, dice: (1, 5, 1), total 7
C, roll or miss? (r/m)? r
C, dice: (1, 5, 1, 1), total 8
C, roll or miss? (r/m)? m
A, roll or miss? (r/m)? m
B, roll or miss? (r/m)? r
B, dice: (2, 3, 1), total 6
B, roll or miss? (r/m)? r
B, dice: (2, 3, 1, 6), total 12 B, roll or miss? (r/m)? m
C, dice: (1, 5, 1, 1), total 8. Points: 4
A, dice: (3, 5), total 8. Points: 2
B, dice: (2, 3, 1, 6), total 12. Winner! Points: 2+2 = 4
Continue next game (y/n)? n