Recap: Dice Simulation
Part of the Data and Plots section of Coddy's Machine Learning journey. Lesson 19 of 60.
Challenge
EasyA board game has 5 rounds of 3 dice. A round is strong when none of its dice is under 4. Simulate one game from the seed the program reads:
- Draw all 15 rolls (1 to 6) at once and fold them into
rounds, one row per round, in draw order. - Build a scoreboard: round number (1 to 5), highest die, lowest die.
- Print it as below, then count the strong rounds.
Here is the game for the seed 13:
Its output:
Round, highest, lowest:
[[1 6 5]
[2 6 1]
[3 6 2]
[4 6 1]
[5 5 4]]
Rounds with no die under 4: 2Try it yourself
import numpy as np
seed = int(input())
# Write your code below
All lessons in Data and Plots
2NumPy Arrays
Creating ArraysShape and SizeRanges of NumbersIndexing and SlicingRecap: Temperature GridPractice on your own: Online Python compiler