-6

As soon as I press "Run Module," a shell window opens with absolutely no errors, but also seems as if nothing is running. I don't have any idea why nothing is happening, but I'm guessing some of my code in the block at the bottom is very scuffed. The game is RPS-7, or Rock Paper Scissors with 7 options. I require some assistance on what to troubleshoot, as there seems to be no problem but there obviously is (the game doesn't actually run, it's just a useless shell). Here's the code, and here's to my first question of many.

import random
def game(choice):
    options = ["Rock", "Paper", "Scissors", "Sponge", "Air", "Water", "Fire"]
    bot = random.choice(options)
    if choice == "Rock" and bot == "Scissors":
        print ("Rock crushes scissors, you win!")
    elif choice == "Rock" and bot == "Fire":
        print ("Rock pounds out fire, you win!")
    elif choice == "Rock" and bot == "Sponge":
        print ("Rock crushes sponge, you win!")
    elif choice == "Rock" and bot == "Paper":
        print ("Paper covers rock, you lose..")
    elif choice == "Rock" and bot == "Water":
        print ("Water erodes rock, you lose..")
    elif choice == "Rock" and bot == "Air":
        print ("Air erodes rock, you lose..")
    elif choice == "Rock" and bot == "Rock":
        print ("Rock tries to pound rock but fails, it's a tie!")
    elif choice == "Paper" and bot == "Rock":
        print ("Paper covers rock, you win!")
    elif choice == "Paper" and bot == "Water":
        print ("Paper floats on the water, you win!")
    elif choice == "Paper" and bot == "Air":
        print ("Paper fans the air, you win!")
    elif choice == "Paper" and bot == "Scissors":
        print ("Paper gets cut by the scissors, you lose..")
    elif choice == "Paper" and bot == "Fire":
        print ("Paper gets burned by the fire, you lose..")
    elif choice == "Paper" and bot == "Sponge":
        print ("Paper gets soaked by the sponge, you lose..")
    elif choice == "Paper" and bot == "Paper":
        print ("Paper tries to cover paper but fails, it's a tie!")
    elif choice == "Scissors" and bot == "Paper":
        print ("Scissors cuts paper, you win!")
    elif choice == "Scissors" and bot == "Air":
        print ("Scissors swishes through air, you win!")
    elif choice == "Scissors" and bot == "Sponge":
        print ("Scissors cuts sponge, you win!")
    elif choice == "Scissors" and bot == "Rock":
        print ("Scissors gets crushed by rock, you lose..")
    elif choice == "Scissors" and bot == "Fire":
        print ("Scissors gets melted by scissors, you lose..")
    elif choice == "Scissors" and bot == "Water":
        print ("Scissors gets eroded by water, you lose..")
    elif choice == "Scissors" and bot == "Scissors":
        print ("Scissors tries to cut scissors but fails, it's a tie!")
    elif choice == "Fire" and bot == "Scissors":
        print ("Fire melts scissors, you win!")
    elif choice == "Fire" and bot == "Paper":
        print ("Fire burns paper, you win!")
    elif choice == "Fire" and bot == "Sponge":
        print ("Fire burns sponge, you win!")
    elif choice == "Fire" and bot == "Rock":
        print ("Fire gets pounded out by rock, you lose..")
    elif choice == "Fire" and bot == "Air":
        print ("Fire gets blown out by air, you lose..")
    elif choice == "Fire" and bot == "Water":
        print ("Fire gets put out by water, you lose..")
    elif choice == "Fire" and bot == "Fire":
        print ("Fire tries to burn fire but fails and creates a bigger fire, creating the biggest brushfire known to man. Therefore, it's a tie!")
    elif choice == "Sponge" and bot == "Air":
        print ("Sponge uses air pockets, you win!")
    elif choice == "Sponge" and bot == "Paper":
        print ("Sponge soaks paper, you win!")
    elif choice == "Sponge" and bot == "Water":
        print ("Sponge absorbs water, you win!")
    elif choice == "Sponge" and bot == "Rock":
        print ("Sponge gets crushed out by rock, you lose..")
    elif choice == "Sponge" and bot == "Fire":
        print ("Sponge gets burnt by fire, you lose..")
    elif choice == "Sponge" and bot == "Scissors":
        print ("Sponge gets cut by scissors, you lose..")
    elif choice == "Sponge" and bot == "Sponge":
        print ("Sponge tries to absorb sponge but fails and solves the world's water problem, however, it's a tie!")
    elif choice == "Water" and bot == "Rock":
        print ("Water erodes rock, you win!")
    elif choice == "Water" and bot == "Fire":
        print ("Water puts out fire, you win!")
    elif choice == "Water" and bot == "Scissors":
        print ("Water rusts scissors, you win!")
    elif choice == "Water" and bot == "Sponge":
        print ("Water gets absorbed by sponge, you lose..")
    elif choice == "Water" and bot == "Air":
        print ("Water gets evaporated by air, you lose..")
    elif choice == "Water" and bot == "Paper":
        print ("Water gets floated on by paper, you lose..")
    elif choice == "Water" and bot == "Water":
        print ("Water tries to put out water, but fails, creating a large tsunami that wipes out San Francisco. This seems oddly familliar to a song. It's a tie!")
    elif choice == "Air" and bot == "Fire":
        print ("Air blows out fire, you win!")
    elif choice == "Air" and bot == "Rock":
        print ("Air erodes rock, you win!")
    elif choice == "Air" and bot == "Water":
        print ("Air evaporates water, you win!")
    elif choice == "Air" and bot == "Paper":
        print ("Air gets fanned by paper, you lose..")
    elif choice == "Air" and bot == "Scissors":
        print ("Scissors swish through air, you lose..")
    elif choice == "Air" and bot == "Sponge":
        print ("Sponges use air pockets, you lose..")   
    elif choice == "Air" and bot == "Air":
        print ("Air tries to blow out air, fails, and creates a tornado. It's a tie!")
def again(x):
    while True:
        if x == "y":
            game(raw_input("Rock, Paper, Scissors, Sponge, Air, Water, or Fire?"))
            again(raw_input("Play RPS - 7 again? y / n."))
        else:
            print ("Goodbye.")
        break
        break
        game(raw_input("Rock, Paper, Scissors, Sponge, Air, Water, or Fire?"))
        again(raw_input("Play RPS - 7 again? y / n."))

What happens when I run the code:

This

Envy
  • 1
  • 1
  • Please read and follow the posting guidelines in the help documentation, as suggested when you created this account. [Minimal, complete, verifiable example](http://stackoverflow.com/help/mcve) applies here. This code is not at all minimal. – Prune Dec 18 '18 at 18:49
  • Speaking of which, I strongly recommend that you adopt incremental programming: write a few lines, test those, and don't add new features until those lines do what you want. Here, you've pounded out -- and *posted* -- 100 lines of untested code, when you haven't been able to even get into the game. Try a simple game of "Rock Paper" until you get the main loop working. – Prune Dec 18 '18 at 18:51
  • Just curious -- how did you come upon this extension instead of "Rock Paper Scissors Lizard Spock"? :-) – Prune Dec 18 '18 at 18:51
  • Ah, I know of RPS lizard spock, but I was looking for something more. This is the start of my incremental programming journey, as I'm gonna go further up the list as soon as I find out whats wrong. – Envy Dec 18 '18 at 18:53
  • When you get to a resolution, please remember to up-vote useful things and accept your favourite answer (even if you have to write it yourself), so Stack Overflow can properly archive the question. – Prune Dec 18 '18 at 18:58

2 Answers2

0

You need to call a function to begin with - right now, you're just defining functions. Add

again('y')

as the last line of the file to start the loop.

Tim
  • 2,756
  • 1
  • 15
  • 31
0

You define two functions and quit without ever calling them. Your entire main program consists of the import statement. It appears that you need something like this at the bottom:

again('y')

As your main program. This will run the again function once.

Prune
  • 76,765
  • 14
  • 60
  • 81