MCPcopy Create free account
hub / github.com/geekcomputers/Python / Dice

Class Dice

diceV2_dynamic.py:5–19  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3
4# Class that that holds dice-functions. You can set the amount of sides and roll with each dice object.
5class Dice:
6 def __init__(self):
7 self.sideCount = 6
8
9 def setSides(self, sides):
10 if sides > 3:
11 self.sides = sides
12 else:
13 print(
14 "This absolutely shouldn't ever happen. The programmer sucks or someone "
15 "has tweaked with code they weren't supposed to touch!"
16 )
17
18 def roll(self):
19 return random.randint(1, self.sides)
20
21
22# =====================================================================

Callers 1

getDicesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected