Okay, this is my first thread on this site..
also, i started learning python, like 2 weeks ago, and prior to that i have had no coding experience.. so if its something simple, dont make fun, just explain ur solution, and why/how it works.
anyways, im trying to write a code, that simulates a game of Yahtzee, with user input.. to begin with i was making it only singleplayer, with no computer player either. now, ive gotten the player to roll his dice, and make his reroll's if neccasary, but now i cant think of a way to make the program generate his score, based on what he wants (1's, 3of kind, fullhouse, etc).
please help???
Code:
reroll_1_1 = input ("do you wish to reroll die1? ")
if reroll_1_1 == "yes":
die1 = random.randint(1, 6)
print (die1)
else:
print ("Next..")
reroll_2_1 = input ("do you wish to reroll die2? ")
if reroll_2_1 == "yes":
die2 = random.randint(1, 6)
print (die2)
else:
print ("Next..")
reroll_3_1 = input ("do you wish to reroll die3? ")
if reroll_3_1 == "yes":
die3 = random.randint(1, 6)
print (die3)
else:
print ("Next..")
reroll_4_1 = input ("do you wish to reroll die4? ")
if reroll_4_1 == "yes":
die4 = random.randint(1, 6)
print (die4)
else:
print ("Next..")
reroll_5_1 = input ("do you wish to reroll die5? ")
if reroll_5_1 == "yes":
die5 = random.randint(1, 6)
print (die5)
else:
print ("Next..")
print ("Your dice rolls are now", die1, die2, die3, die4, die5)
field_1 = input ("Which box will you place your score in? (1-13) ")
if field_1 == "1":
score_ask = input("How many 1's did you roll? ")
score = (1 * score_ask)
if field_1 == "2":
score_ask = input("How many 2's did you roll? ")
score = (2 * score_ask)
This is an outtake of the ending.. after the 2nd reroll.
Here is the list of rules, i will be going off..
http://grail.sourceforge.net/demo/yahtzee/rules.html
im really stuck.. please help?