mirror of
https://github.com/coding-horror/basic-computer-games.git
synced 2025-12-22 15:16:33 -08:00
MAINT: Apply pre-commit
Remove byte-order-marker pre-commit check as there would be many adjustments necessary
This commit is contained in:
@@ -1,51 +1,56 @@
|
||||
from random import randint
|
||||
|
||||
print("Math Dice")
|
||||
print("https://github.com/coding-horror/basic-computer-games")
|
||||
print()
|
||||
print("""This program generates images of two dice.
|
||||
print(
|
||||
"""This program generates images of two dice.
|
||||
When two dice and an equals sign followed by a question
|
||||
mark have been printed, type your answer, and hit the ENTER
|
||||
key.
|
||||
To conclude the program, type 0.
|
||||
""")
|
||||
"""
|
||||
)
|
||||
|
||||
|
||||
def print_dice(n):
|
||||
|
||||
def print_0():
|
||||
print("| |")
|
||||
|
||||
def print_2():
|
||||
print("| * * |")
|
||||
|
||||
print(" ----- ")
|
||||
|
||||
if n in [4,5,6]:
|
||||
if n in [4, 5, 6]:
|
||||
print_2()
|
||||
elif n in [2,3]:
|
||||
elif n in [2, 3]:
|
||||
print("| * |")
|
||||
else:
|
||||
print_0()
|
||||
|
||||
if n in [1,3,5]:
|
||||
if n in [1, 3, 5]:
|
||||
print("| * |")
|
||||
elif n in [2,4]:
|
||||
elif n in [2, 4]:
|
||||
print_0()
|
||||
else:
|
||||
print_2()
|
||||
|
||||
if n in [4,5,6]:
|
||||
if n in [4, 5, 6]:
|
||||
print_2()
|
||||
elif n in [2,3]:
|
||||
elif n in [2, 3]:
|
||||
print("| * |")
|
||||
else:
|
||||
print_0()
|
||||
|
||||
print(" ----- ")
|
||||
|
||||
|
||||
def main():
|
||||
|
||||
while True:
|
||||
d1 = randint(1,6)
|
||||
d2 = randint(1,6)
|
||||
d1 = randint(1, 6)
|
||||
d2 = randint(1, 6)
|
||||
guess = 13
|
||||
|
||||
print_dice(d1)
|
||||
@@ -70,10 +75,8 @@ def main():
|
||||
else:
|
||||
print("Correct!")
|
||||
|
||||
|
||||
print("The dice roll again....")
|
||||
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
main()
|
||||
|
||||
Reference in New Issue
Block a user