Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New dice/coin thing #22

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 49 additions & 20 deletions diceRoller.py
Original file line number Diff line number Diff line change
@@ -1,34 +1,63 @@
#Coin flip program
#Describe the purpose of this program here.

inport random;time

import random,time
#these are dice faces
s1 = "- - - - -\n| |\n| O |\n| |\n- - - - -\n"
s2 = "- - - - -\n| O |\n| |\n| O |\n- - - - -\n"
s3 = "- - - - -\n| O |\n| O |\n| O |\n- - - - -\n"
s3 = "- - - - -\n| O |\n| O |\n| O |\n- - - - -\n"
s4 = "- - - - -\n| O O |\n| |\n| O O |\n- - - - -\n"
s5 = "- - - - -\n| O O |\n| O |\n| O O |\n- - - - -\n"
s6 = "- - - - -\n| O O |\n| O O |\n| O O |\n- - - - -\n"

def roll():
Print("rolling....."
roll = rand.randing(7)
def rollDice():
print("Rolling.....")
roll = random.randint(1,6) #makes random integer

return roll


def show_dice(roll)
if roll = 1:
print(S1)
else roll = 2
def diceshow(roll):
if roll == 1:
print(s1)
elif roll == 2:
print(s2)
else roll = 3
elif roll == 3:
print(s3)
else roll = 4
elif roll == 4:
print(s4)
else roll = 5
elif roll == 5:
print(s5)
else roll = 6
elif roll == 6:
print(s6)
else:
print("Something is wrong with this code.")
print(roll) #Small debug tool

def 2inrow():
howManyRolls=int(input("How many times would you like to roll? > "))
prevRoll="0"
for x in range(howManyRolls):
myRoll=rollDice()
time.sleep(1)
diceshow(myRoll)
#print(myRoll) #debug
if prevRoll==myRoll:
print("You win life. Grats.")
break
prevRoll=myRoll

def when6():
howManyRolls=int(input("How many times would you like to roll? > "))
prevRoll="0"
for x in range(howManyRolls):
myRoll=rollDice()
time.sleep(1)
diceshow(myRoll)
#print(myRoll)
if myRoll==6:
print("You win.")
break

roll
time.sleep(1)
show_dice(roll)
whichGame=str(input("Would you like it to stop at 2 in a row (t), \nOr when you get a six (s)? > "))
if whichGame=="t":
2inrow()
elif whichGame=="s":
when6()