Forums

Just a little more help necessary to complete my game code

Hey everyone. I've almost completed my game code but need to do the following step for it to be 100% complete:

Now that we’ve completed our game and gone over the basic functions in our bridge scene, it’s your turn to explain and document code! In your script, add comments to the “escape cave” scene that accurately describe what each item does and why. Make sure to not just cover classes but also each code function and variable. This can be line by line, or for a cleaner approach, one condensed comment for each block of code or function. This is your chance to explain how code mechanics work for future developers (or your future self) to reference, so be as thorough as possible.

I don't know where the comments need to go or what I need to put for the comments. The following is my escape cave code:

class EscapeCave(Scene): ''' Where the hero escapes, but only after guessing the right escape cave. ''' name = "Escape Cave" descrip = ''' There are five tunnels leading to the outside of the caves. The tunnels are numbered 1 through 5.'''

def action(self):
    cavenum = randint(1, 5)
    while True:
        response = input("").lower()
        if "look" in response:
            print(self.descrip)
        elif "go" in response:
            choice = int(input("Which tunnel? ").lower())
            if choice == cavenum:
                self.cave_escape()
            elif choice  5:
                print("There are only 5 tunnels!")
            else:
                print("That tunnel seems to be full of rocks you can't get past.")
        elif "leave" in response or "exit" in response:
            return 'corridor'
        elif response != "":
            print("Huh? I didn't understand that.")
        else:
            print("Something went wrong ...")
            return 'death'

def cave_escape(self):
    print("You escaped into the sunlight!")
    book_on_bridge = Map.scenes['bridge'].book
    if book_on_bridge and book_on_bridge.activated:
        print("The caves explode in a million pieces, destroying all of ")
        print("the trolls and magic spell books left behind!")
        print("Safe in the sunlight, you walk away to claim your reward.\n")
        try:
            exit()  # avoid a traceback by catching the exit error
        except SystemExit:
            print("Game over.")
    else:
        print("But did you forget something? The trolls are throwing rocks")
        print("at you! You never used your magic spell to destroy them!")
        print("That is the end of you!\n")
        try:
            exit()  # avoid a traceback by catching the exit error
        except SystemExit:
            print("Game over.")

Any help would be appreciated. Thanx!! :)

I've been waiting for a response to my problem here. Please help as soon as possible.

Thanx!! :)

This is not a general homework help forum. It is a support forum for PythonAnywhere, so you may not get the help that you want.

Ok