- class tabletoppy.coin.Coin(face: Face | None = None)
A class used to represent a coin with two sides, heads and tails
- class Face(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)
An Enum representing the two sides of a coin
- property face: Face
The face currently displayed to the world
- Returns:
The face currently displayed to the world
- Return type:
- is_heads() bool
Convenience method for checking whether the coin is showing heads
- Returns:
True if coin is showing heads, false otherwise
- Return type:
bool
- is_tails() bool
Convenience method for checking whether the coin is showing tails
- Returns:
True if coin is showing tails, false otherwise
- Return type:
bool
- toss() Self
Toss the coin to randomly generate a heads or tails result
- Returns:
The same coin with either heads or tails showing, determined randomly
- Return type:
Self
- turn() Self
Turns a coin to reveal the other face
- Returns:
The turned coin with the other face on display
- Return type:
Self
- class tabletoppy.die.Die(sides: int = 6, face: int | None = None)
- property face: int
Getter for the face attribute
- Returns:
The current uppermost face of the die
- Return type:
int
- roll() Self
Roll the die to randomly generate a number matching one of the sides
- Returns:
The die with a randomly determined face lying uppermost
- Return type:
Self