-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 07ad076
Showing
2 changed files
with
124 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import os | ||
import time | ||
from random import randint | ||
from dices import dices | ||
|
||
|
||
def roll_dice(): | ||
n = 0 | ||
while n < 3: | ||
dice = randint(1, 6) | ||
os.system('clear') | ||
if dice == 1: | ||
dices.one() | ||
if dice == 2: | ||
dices.two() | ||
if dice == 3: | ||
dices.three() | ||
if dice == 4: | ||
dices.four() | ||
if dice == 5: | ||
dices.five() | ||
if dice == 6: | ||
dices.six() | ||
time.sleep(.400) | ||
n += 1 | ||
|
||
|
||
keep_rolling = True | ||
while keep_rolling: | ||
user_input = input("\nRoll the dice (y/n): ") | ||
if user_input.lower() == 'y': | ||
roll_dice() | ||
elif user_input.lower() == 'n': | ||
keep_rolling = False | ||
os.system('clear') | ||
print("\nHave a nice day!!") | ||
else: | ||
print("\nWrong input type (y)es to roll again or (n)o to exit") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
class dices: | ||
'''Graphical versions of the six sides of a dice''' | ||
|
||
def one(): | ||
'''Prints the value one of the dice.''' | ||
print(""" | ||
-------------- | ||
| | | ||
| | | ||
| | | ||
| ## | | ||
| ## | | ||
| | | ||
| | | ||
| | | ||
--------------""") | ||
|
||
def two(): | ||
'''Prints the value one of the dice.''' | ||
print(""" | ||
-------------- | ||
| ## | | ||
| ## | | ||
| | | ||
| | | ||
| | | ||
| | | ||
| ## | | ||
| ## | | ||
--------------""") | ||
|
||
def three(): | ||
'''Prints the value one of the dice.''' | ||
print(""" | ||
-------------- | ||
| ## | | ||
| ## | | ||
| | | ||
| ## | | ||
| ## | | ||
| | | ||
| ## | | ||
| ## | | ||
--------------""") | ||
|
||
def four(): | ||
'''Prints the value one of the dice.''' | ||
print(""" | ||
-------------- | ||
| ## ## | | ||
| ## ## | | ||
| | | ||
| | | ||
| | | ||
| | | ||
| ## ## | | ||
| ## ## | | ||
--------------""") | ||
|
||
def five(): | ||
'''Prints the value one of the dice.''' | ||
print(""" | ||
-------------- | ||
| ## ## | | ||
| ## ## | | ||
| | | ||
| ## | | ||
| ## | | ||
| | | ||
| ## ## | | ||
| ## ## | | ||
--------------""") | ||
|
||
def six(): | ||
'''Prints the value one of the dice.''' | ||
print(""" | ||
-------------- | ||
| ## ## | | ||
| ## ## | | ||
| | | ||
| ## ## | | ||
| ## ## | | ||
| | | ||
| ## ## | | ||
| ## ## | | ||
--------------""") |