473,320 Members | 2,094 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Hidden error in my program? and are there any easy-to-use Debuggers?

Its me again : )
I added a fight with a zombie to my text-based RPG game using 'while' as well as a Retry option. (I was experimenting with the 'while' function)

And now, when I save and try to run my program, it opens and closes before I can see anything. I think there is an error in my code, but when I Run Module with IDLE, it runs fine and I do not encounter any error throughout the whole program.

So I would like someone to either post a reliable and easy-to-use Debugger/Error Checker, or look through my code to find the error.
A debugger would make me less dependent on asking for help : p

Here is my code if you want to try to find the error.

Expand|Select|Wrap|Line Numbers
  1. #Boyyini's Dungeon Game
  2. #This is a short text-based dungeon-adventure game. Enjoy!
  3.  
  4. import time
  5. import random
  6.  
  7. health = 100
  8. zombie = 100
  9.  
  10. #Welcomes user and explains game
  11. print("Welcome to Boyyini's first program. \nThis is my first attempt at making a program from scratch.")
  12. time.sleep(5)
  13. print("In this program I will be taking you through a text-based mini-adventure.")
  14. time.sleep(4)
  15. print("\nWhen a question is asked, type one of the resposes that are in single quotes.")
  16. time.sleep(4)
  17. print("\nOnly valid responses will have single quotes around them. ")
  18. raw_input("\nWhen you want to continue, Press Enter.")
  19. raw_input("\n\nNow I will ask a few questions about you, just cause I can.")
  20. print("First, I will ask you your name.")
  21. name = raw_input("Please enter your name: ")
  22. raw_input("Hello, " + name + ". Thanks for playing my game.")
  23. gender = raw_input("Are you a guy or girl? ")
  24. print ("\nYou're a " + gender + "? Okay, cool.")
  25. age = raw_input("How old are you? ")
  26. print "Alright. That\'s old enough to play this game."
  27. raw_input("Last question, do you have extensive liability insurance?")
  28. raw_input("Ha ha ha, just kidding! ... Press Enter to start your adventure!")
  29.  
  30. print("\n\nOkay! Now you\'re at the entrance of the cave!")
  31. a = raw_input("Do you want to \'run in\' or \'walk in\'? ")
  32. if a == "run in":
  33.     raw_input("\nYou burn a few calories. Exersise freak...")
  34.     raw_input("You enter a large cavern, there is a small hole in the ceiling that lets a small amount of light in.")
  35. if a == "walk in":
  36.     raw_input("\nYou slowly walk in.\nYou enter a large cavern, there is a small hole in the ceiling that lets a small amount of light in")
  37. zombies = "yes"
  38. while zombies == "yes":
  39.     print("\nYou see about 20 zombies lumbering around 30 feet away. How do you want to kill them?")
  40.     b = raw_input("Kill zombies with: \'double barrel\', \'chainsaw\', or \'teeth?\' ")
  41.     if b == "double barrel":
  42.         raw_input("You pull out your double barrel shotgun and kill 3 zombies with the first blast.")
  43.         raw_input("The remaining 17 zombies start to lumber towards you as you reload.")
  44.         raw_input("You fire again and kill 5 more zombies. The zombies are only 10 feet away.")
  45.         raw_input("As you reload again, the zombies get to you and eat your brains.")
  46.         print("""\n\n\n
  47.               ________      _____       _________    _
  48.              |   _____|    /  _  \     |___   ___|  | |
  49.              |  |____     /  /_\  \        | |      | |
  50.              |   ____|   /  _____  \       | |      | |
  51.              |  |       /  /     \  \   ___| |___   | |____
  52.              |__|      /__/       \__\ |_________|  |______|""")
  53.         time.sleep(1)
  54.         zombies = raw_input("\nRetry? yes or no?")
  55.         print("\n\n")
  56.     if b == "teeth":
  57.         print("You quickly floss.")
  58.         time.sleep(1)
  59.         raw_input("You charge the zombies, teeth shining, even in the dim light.")
  60.         raw_input("You jump on the closest zombie and take a chunk out of its neck. Eww...")
  61.         raw_input("You are then swarmed by the other 19 zombies and they eat your brains.")
  62.         raw_input("Were you really thinking to kill 20 zombies with your teeth?")
  63.         print("""\n\n\n
  64.               ________      _____       _________    _
  65.              |   _____|    /  _  \     |___   ___|  | |
  66.              |  |____     /  /_\  \        | |      | |
  67.              |   ____|   /  _____  \       | |      | |
  68.              |  |       /  /     \  \   ___| |___   | |____
  69.              |__|      /__/       \__\ |_________|  |______|""")
  70.         time.sleep(1)
  71.         zombies = raw_input("\nRetry? yes or no?")
  72.         print("\n\n")
  73.  
  74.     if b == "chainsaw":
  75.         raw_input("You pull out your chainsaw and start it.")
  76.         raw_input("The zombies hear the chainsaw and start lumbering towards you.")
  77.         raw_input("With your chainsaw raised, you charge the zombies, screaming.")
  78.         raw_input("You kill zombie after zombie with the chainsaw.")
  79.         raw_input("You kill the last zombie and toss your chainsaw aside.")
  80.         zombies = "no"
  81.  
  82.         tunnel = "yes"
  83.         while tunnel == "yes":
  84.             raw_input("\nYou see two tunnels.")
  85.             c = raw_input("\nWhich tunnel do you want to go into?\n\'left\' or \'right\'? ")
  86.             if c == "left":
  87.                 raw_input("You walk along the tunnel. The warm air turns into steam.")
  88.                 raw_input("You see a yellow light ahead.")
  89.                 raw_input("You enter a large room with a molten lava river in the middle.")
  90.                 raw_input("You step near the lava")
  91.                 print("*bubble* *bubble* *bubble*")
  92.                 raw_input("A bubble of lava pops and splatters lava on your head.")
  93.                 print("\n YOU ARE DEAD!")
  94.                 time.sleep(1)
  95.                 print("""\n\n\n
  96.                   ________      _____       _________    _
  97.                  |   _____|    /  _  \     |___   ___|  | |
  98.                  |  |____     /  /_\  \        | |      | |
  99.                  |   ____|   /  _____  \       | |      | |
  100.                  |  |       /  /     \  \   ___| |___   | |____
  101.                  |__|      /__/       \__\ |_________|  |______|""")
  102.                 time.sleep(1)
  103.                 tunnel = raw_input("\nRetry? yes or no? ")
  104.                 print("\n\n")
  105.             if c == "right":
  106.                 tunnel = "no"
  107.                 raw_input("You walk down the right tunnel.")
  108.                 raw_input("You hear a mumbling, grumbling noise.")
  109.                 raw_input("You see another zombie ahead. This one is about 7 feet tall.")
  110.                 big_zombie = raw_input("Do you want to fight it? \'yes\' or \'no\'? ")
  111.                 if "es" in big_zombie:
  112.                     while health >= 0 and zombie >= 0:
  113.                         human_damage = random.randint(30, 50)
  114.                         zombie_damage = random.randint(15, 30)
  115.                         health -= zombie_damage
  116.                         zombie -= human_damage
  117.                         raw_input("The zombie hits you and you take " + str(zombie_damage) + " damage.\nYou have " + str(health) + " health left.")
  118.                         raw_input("You hit the zombie and it takes " + str(human_damage) + " damage.\nIt has " + str(zombie) + " health left.")
  119.                         if health <= 0:
  120.                             raw_input("Your character is dead.")
  121.                         if zombie <= 0:
  122.                             raw_input("You kill the zombie, but you are injured.")
  123.                             raw_input("You beat the boss! Congratulations!")
  124.                 if "o" in big_zombie:
  125.                     tunnel = "yes"
  126.                     raw_input("You turn around and head back out of the tunnel, the zombie not seeing you.")
  127.                     raw_input("You are back at the entrance of the two tunnels.")
  128.  
  129.  
  130.  
  131. print("\n\n\nThanks for playing \'Boyyini\'s Dungeon Game\'")
  132. time.sleep(3)
  133. print("\nAll coding done by Boyyini using Python.")
  134. time.sleep(3)
  135. print("""\n
  136.   ____                    _       _   _____           _           _        _           
  137.  |  _ \                  (_)     (_) |_   _|         | |         | |      (_)          
  138.  | |_) | ___  _   _ _   _ _ _ __  _    | |  _ __   __| |_   _ ___| |_ _ __ _  ___  ___ 
  139.  |  _ < / _ \| | | | | | | | '_ \| |   | | | '_ \ / _` | | | / __| __| '__| |/ _ \/ __|
  140.  | |_) | (_) | |_| | |_| | | | | | |  _| |_| | | | (_| | |_| \__ \ |_| |  | |  __/\__ \
  141.  
  142.  |____/ \___/ \__, |\__, |_|_| |_|_| |_____|_| |_|\__,_|\__,_|___/\__|_|  |_|\___||___/
  143.                __/ | __/ |                                                             
  144.               |___/ |___/""")
  145.  
  146. raw_input("\n\nPress the enter key to exit.\n")
  147. raw_input("")
  148.  
Apr 16 '10 #1
1 1342
bvdet
2,851 Expert Mod 2GB
I was able to run your program without error from the command prompt.
Apr 16 '10 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

9
by: Andrew Durstewitz | last post by:
Hi! I am having a really strange issue. I have a few users calling in saying they are getting an error. On further review I found this line is what is causing it... Set strLookup =...
5
by: sams | last post by:
I've seen this covered before, but I just don't understand Java very well. I apologize if this is a repeat. Basically, I need a text/java style submit form with multiple hidden fields. It would...
8
by: Vavel | last post by:
Hi all! I used google, but I found nothing. I have got smiple code: #include <sql.h> int main() { } when I compiled this in Borland C++ 5.5.1 for Win32 Copyright (c) 1993,
2
by: Brian Herbert Withun | last post by:
I'm having difficulty catching dbi.program-error which occurs this way: import dbi, odbc self.__cur.execute(sql) >>> dbi.program-error: Table 'depfile' not found in EXEC but
7
by: parag1234567 | last post by:
Hi, I am dynamically generating a html file which will contain only <div> tags which contents are hidden from user( set by style="visibility:hidden") Now the next step is i am enabling some of...
6
by: dba | last post by:
using the following code with a problem.... echo "<input type='hidden' name='member_id' value=\"{$row}\">{$row}"; echo "<input type='radio' name='member_name' value=\"{$row}\">{$row}<br />"; ...
1
by: rohit.d.agarwal | last post by:
Hi All, I have two types of hidden elements on my form Type A) the id of the element is static (see below) <html:hidden name="qtyPlanForm" property="status" styleId="stat01" />
2
by: Omar Abid | last post by:
Reason of this project: Error handling is one of the most difficult thing that may afford a programmer. It isn't as easy as you think and handling errors in a program some time can make errors...
11
by: viki1967 | last post by:
Hidden field Hello my friends. This is a htm page that contains a form open in window popUp ( page daughter ). This form insert a value in the one hidden field called "tec", in other form...
12
by: techani | last post by:
hi , I have a problem in the following program (at the first link ) , which is : I send a simple encrypted message in AES , the encrypting and sending operations is done ok with no any...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.