Ibby19 / Assignment_1

Rolling multi-sided dice

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Assignment_1

Rolling multi-sided dice

Description of the task A normal die (the singular of dice) is a cube, and each face shows a number from one to six. Some games employ nonstandard dice that may have fewer (e.g. four) or more (e.g. thirteen) sides. Let’s design a general class MSDie to model multi-sided dice. We could use such an object in any number of simulation or game programs. Each MSDie object will know two things:

How many sides it has Its current value When a new MSDie is created, specify how many sides it will have (e.g n). The die can be operated on through three provided methods: roll, to set the die to a random value between 1 an n, exclusively; setValue, to set the die to a specific value (i.e cheat); and getValue to see what current value is.

About

Rolling multi-sided dice


Languages

Language:Python 100.0%