Bag Of Cows

Pseudo Code Library

Dice Game

The flowchart describes a game in which a player rolls three standard dice and then gets a score based on how many of the dice are showing the same number.

Main task:

Code this game so it performs exactly as described in the flowchart.

Extension one:

Currently the game runs only once. Adapt your code so that after each play it asks you whether you want to play again, or quit.

If you play again, it should ask for the player name again.

If you quit, it should thank you for playing.

Extension two:

Currently the game mimics using standard dice, so the result of a roll can be from 1 to 6. Adapt it so that at the start it allows you to choose a difficulty level, and have the dice roll be between 1 and the number you chose.

Here is some sample code which will get you started in Python

import random

dice1 = random.randint(1,6)