From 6f4f781ab944fecd70c0964f2dd1da95d4007fc3 Mon Sep 17 00:00:00 2001 From: Vivek Date: Mon, 6 Jul 2026 12:05:01 +0530 Subject: [PATCH] added new roller dice game --- dice_roller.py | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 dice_roller.py diff --git a/dice_roller.py b/dice_roller.py new file mode 100644 index 00000000000..de805c61646 --- /dev/null +++ b/dice_roller.py @@ -0,0 +1,57 @@ +import random + + +dice_art = { + 1: ("┌─────────┐", + "│ │", + "│ ● │", + "│ │", + "└─────────┘"), + 2: ("┌─────────┐", + "│ ● │", + "│ │", + "│ ● │", + "└─────────┘"), + 3: ("┌─────────┐", + "│ ● │", + "│ ● │", + "│ ● │", + "└─────────┘"), + 4: ("┌─────────┐", + "│ ● ● │", + "│ │", + "│ ● ● │", + "└─────────┘"), + 5: ("┌─────────┐", + "│ ● ● │", + "│ ● │", + "│ ● ● │", + "└─────────┘"), + 6: ("┌─────────┐", + "│ ● ● │", + "│ ● ● │", + "│ ● ● │", + "└─────────┘") +} + +dice = [] +total = 0 +num_of_dice = int(input("How many dice?: ")) + +for die in range(num_of_dice): + dice.append(random.randint(1, 6)) + +# PRINT VERTICALLY +# for die in range(num_of_dice): +# for line in dice_art.get(dice[die]): +# print(line) + +# PRINT HORIZONTALLY +for line in range(5): + for die in dice: + print(dice_art.get(die)[line], end="") + print() + +for die in dice: + total += die +print(f"total: {total}") \ No newline at end of file