jeudi 26 mai 2016

Hockey Decision Game using If-Statements [duplicate]

This question already has an answer here:

I'm making a virtual hockey game that you create your own future. You are told two different scenarios and you have to decide which one to choose, you have a 50/50 chance of getting your choice right. Anyways, I'm having some issues with my code. It will not print anything after your first decision. I can't figure out what was happening with it. Here is the section of the code.

print 'A young star here today in his first ever NHL game. He is a right winger and was drafted first overall by the Toronto Maple Leafs!'
print 'The puck drops and the Leafs win the faceoff! The puck is passed upto', name, 'and he cuts up the right side.'
print 'An opposing player comes in for the big hit! What do you do, pass or deke? Enter "1" to pass or "2" to deke.'
passdeke = raw_input()
option1 = random.randint(1,2)
if passdeke == option1 and passdeke == 2:
    #put in deke
    print 'What a play by the young star! He now cuts down the boards, you must now choose to go behind the net or pass infront.'
    option2 = random.randint(1,2)
    passhold = raw_input()
    if passhold == option2 and passhold == 2:
        print 'He now cuts behind the net safley.'
        #put in fake pass cut behind
        print 'You now have an option to pass infront or go for the rap around. Select 1 to pass and 2 to rap around.'
        passrap = raw_input()
        option3 = random.randint(1,2)
        if passrap == option3 and passrap == 1:
            #put in cool pass infront
            print 'What a pass to an easy goal! The young star shows off his skills early.' 

        if passrap == option3 and passrap == 2:
            #show rap around in air
            print 'He pulls off an amamzing rap around lifting the puck onto his stick!'


        if passrap != option3 and passrap == 1:
            print 'The pass is knocked away! Turned over by', name

    elif passhold == option2 and passhold == 1:
        #should behind back pass to net
        print 'A great behind the back pass from', name, 'from the top of the circle.'

    elif passhold != option2 and passhold == 1:
        #show pass getting intercepted
        print 'Oh no! The pass is intercepted!'

    else:
        #show big hit behind net
        print 'The star chooses to cut behind the net... Oh no!! He gets nailed behind the net, he is out for at least 3 weeks!'



elif passdeke == option1 and passdeke == 1:
    #put in cool pass at center ice
    print 'A great pass by young star to a streaking player up the wing.'
    print 'You now need to choose if you want to cut backdoor or hang up high for the one timer.'
    print 'Select "1" to go backdoor or "2" to go up high.'
    highlow = raw_input()
    option3 = random.randint(1,2)
    if highlow == option3 and highlow == 1:
        #show backdoor goal
        print 'A great pass to the young start who scored a great goal!'

elif passdeke != option1 and passdeke == 1:
    #show someone intercepting pass
    print 'Oh no! The pass is interceted! A turnover from', name

elif passdeke != option1 and passdeke == 2:
    #show huge hit
    print 'Oh no! A huge hit against', name, 'That is going to be a season ending hit.'

P.S. I am planning on putting in GIFs in, in the future. That is why there are comments telling me to do so. Also, the variable 'name' is just the person name. It will input in an earlier section of the code.

Aucun commentaire:

Enregistrer un commentaire