forked from CodeMouse92/DeadSimplePython
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdice_roll.py
More file actions
25 lines (19 loc) · 659 Bytes
/
dice_roll.py
File metadata and controls
25 lines (19 loc) · 659 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import random
import typing
TupleInts = typing.Tuple[int, ...]
def roll_dice(sides: int = 6, dice: int = 1) -> TupleInts:
# return random.randint(1, sides)
return tuple(random.randint(1, sides) for _ in range(dice))
print("Roll for initiative...")
# player1 = roll_dice(20)
# player2 = roll_dice(20)
player1, player2 = roll_dice(20, 2)
if player1 >= player2:
print(f"Player 1 goes first (rolled {player1}).")
else:
print(f"Player 2 goes first (rolled {player2}).")
# dice_cup = roll_dice(6, 5)
# dice_cup = roll_dice(sides=6, dice=5)
# dice_cup = roll_dice(dice=5, sides=6)
# dice_cup = roll_dice(dice=5)
dice_cup = roll_dice(6, dice=5)