Python Forum
Thread Rating:
  • 2 Vote(s) - 1.5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
dice game im stuck
#1
Hey, I just joined this forum and I have a controlled assessment which we're allowed to use the internet for help and my question is, how would I allow one player to 'ROLL' the dice and then allow the second player to 'ROLL' the dice. It needs to track both players scores seperately and add on what number they rolled to what they previously rolled. What it does it allows the user to roll the dice and after 6 seconds generates a random number between 1-6, after this it 

    print("Alright, please type 'ROLL' to roll the dice")

def rollDice(player):
    roll = input("")
    while True:
        if roll != "ROLL":
            print("Invalid input, please try again (case sensitive)")
            break
        else:
            print("Rolling.")
            time.sleep(2) #pauses script for 2s before continuing
            print("Rolling..")
            time.sleep(2)
            print("Rolling...")
            time.sleep(2)
            dice_num=random.randint(1,6)#picks random number between 1-6
            p1score = dice_num
            print(namep1,", you're now on space",p1score)
            if p1score or p2score == 49:
                playerWin()
            return
        
def main():
    rollDice(namep1)
    rollDice(namep2)

main()
Reply


Messages In This Thread
dice game im stuck - by sylerr - May-12-2017, 05:59 PM
RE: dice game im stuck - by sparkz_alot - May-12-2017, 06:34 PM
RE: dice game im stuck - by sylerr - May-12-2017, 06:58 PM
RE: dice game im stuck - by ichabod801 - May-12-2017, 10:50 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Need some help with Dice Game for daughter in school OptX 2 2,058 Feb-12-2021, 08:43 PM
Last Post: BashBedlam
  regarding dice game hola123 4 2,493 Feb-10-2021, 11:00 PM
Last Post: hola123
  Two dice Game of Pig help elliemehl 2 4,349 Feb-14-2019, 01:19 AM
Last Post: woooee
  Two Dice Pig Game in Python 3.6 Help inspired22 4 11,816 Oct-10-2018, 01:17 PM
Last Post: ichabod801
  help with while loop on dice game sean5 2 4,314 Dec-14-2017, 07:24 PM
Last Post: nilamo

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020