Skip to content

Commit 6f4f781

Browse files
committed
added new roller dice game
1 parent ddf890c commit 6f4f781

1 file changed

Lines changed: 57 additions & 0 deletions

File tree

dice_roller.py

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
import random
2+
3+
4+
dice_art = {
5+
1: ("┌─────────┐",
6+
"│ │",
7+
"│ ● │",
8+
"│ │",
9+
"└─────────┘"),
10+
2: ("┌─────────┐",
11+
"│ ● │",
12+
"│ │",
13+
"│ ● │",
14+
"└─────────┘"),
15+
3: ("┌─────────┐",
16+
"│ ● │",
17+
"│ ● │",
18+
"│ ● │",
19+
"└─────────┘"),
20+
4: ("┌─────────┐",
21+
"│ ● ● │",
22+
"│ │",
23+
"│ ● ● │",
24+
"└─────────┘"),
25+
5: ("┌─────────┐",
26+
"│ ● ● │",
27+
"│ ● │",
28+
"│ ● ● │",
29+
"└─────────┘"),
30+
6: ("┌─────────┐",
31+
"│ ● ● │",
32+
"│ ● ● │",
33+
"│ ● ● │",
34+
"└─────────┘")
35+
}
36+
37+
dice = []
38+
total = 0
39+
num_of_dice = int(input("How many dice?: "))
40+
41+
for die in range(num_of_dice):
42+
dice.append(random.randint(1, 6))
43+
44+
# PRINT VERTICALLY
45+
# for die in range(num_of_dice):
46+
# for line in dice_art.get(dice[die]):
47+
# print(line)
48+
49+
# PRINT HORIZONTALLY
50+
for line in range(5):
51+
for die in dice:
52+
print(dice_art.get(die)[line], end="")
53+
print()
54+
55+
for die in dice:
56+
total += die
57+
print(f"total: {total}")

0 commit comments

Comments
 (0)