Go Back   CodingForums.com > :: Computing & Sciences > Computer Programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 03-31-2011, 01:17 AM   PM User | #1
Gobble45
New to the CF scene

 
Join Date: Mar 2011
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Gobble45 is an unknown quantity at this point
Unhappy Python.. noob needing help!

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?

Last edited by Gobble45; 03-31-2011 at 02:30 AM.. Reason: more info
Gobble45 is offline   Reply With Quote
Reply

Bookmarks

Tags
die, python, random, reroll, yahtzee

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 09:58 AM.


Advertisement
Log in to turn off these ads.