online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code   
Language
import time import random import os print("Hello player, your goal is to earn 100 gold pieces") def ocean_a_1(gold,skillz,deer,fish,result): result = "" while result != "exit" : ocean_a_1_options= input("\nCongrats! You are on a raft randomly floating in the ocean.\nHow did you think that you were going to catch any fish though?\ntype (return) to go back to the shoreline.\ntype (float) to float here randomly\ntype (search) to look for a fishing pole down the beach :\n\n") if ocean_a_1_options == "": continue choices = { "return": ocean_1, "search": ocean_a_3, "float": ocean_a_2, "exit": lambda x,y,z,b: "exit" }; choice = choices.get(ocean_a_1_options, invalid_entry); result = choice(gold,skillz,deer,fish,result) def ocean_a_3(gold,skillz,deer,fish,result): result = "" while result != "exit" : ocean_a_3_options= input("\nYou searched for a fishing pole down the shore a ways with no luck\ntype (return) to head back to the ocean :\n\n") if ocean_a_3_options == "": continue choices = { "return": ocean_a_1, "exit": lambda x,y,z,b: "exit" }; choice = choices.get(ocean_a_3_options, invalid_entry); result = choice(gold,skillz,deer,fish,result) def ocean_b_1(gold,skillz,deer,fish,result): skillz = skillz + 12 result = "" while result != "exit" : player_number= input("\nUh Oh....\nI don't think that that dude is happy that you are stealing his boat!\ntype a number 1-5\n\n") val = int(player_number) my_rand = random.randint(1,5) weighted_number = val + my_rand if weighted_number == "": continue choices = { 2 : ocean_b_1_1, 3 : ocean_b_1_3, 4 : ocean_b_1_1, 5 : ocean_b_1_3, 6 : ocean_b_1_3, 7 : ocean_b_1_1, 8 : ocean_b_1_3, 9 : ocean_b_1_2, 10 : ocean_b_1_1, "exit": lambda x,y,z,b: "exit" }; choice = choices.get(weighted_number, invalid_entry); result = choice(gold,skillz,deer,fish,result) def ocean_b_1_1(gold,skillz,deer,fish,result): skillz = skillz + 35 result = "" while result != "exit" : ocean_b_1_1_options = input("Congrats! You now own a boat! And yay - it even has a fishing pole in it!\ntype (fish) to take it fishing.\ntype (abandon) to return the shoreline :\n\n") if ocean_b_1_1_options == "": continue choices = { "abandon" : ocean_1, "fish" : ocean_fishing, "exit": lambda x,y,z,b: "exit" }; choice = choices.get(ocean_b_1_1_options, invalid_entry); result = choice(gold,skillz,deer,fish,result) def ocean_fishing(gold,skillz,deer,fish,result): result = "" while result != "exit" : player_number= input("\nSo you want to go fishing? Type a number 1-5 :\n\n") val = int(player_number) my_rand = random.randint(1,5) weighted_number = val + my_rand if weighted_number == "": continue choices = { 2 : ocean_fishing_high, 3 : ocean_fishing_med, 4 : ocean_fishing_low, 5 : ocean_fishing_med, 6 : ocean_fishing_med, 7 : ocean_fishing_med, 8 : ocean_fishing_low, 9 : ocean_fishing_med, 10 : ocean_fishing_high, "exit": lambda x,y,z,b: "exit" }; choice = choices.get(weighted_number, invalid_entry); result = choice(gold,skillz,deer,fish,result) def ocean_fishing_low(gold,skillz,deer,fish,result): fish = fish + 5 skillz = skillz + 15 print("\n\nCongrats you got 5 fish") print("you currently have\n",gold,"gold\n",deer,"deer\n",fish,"fish") result = "" while result != "exit" : ocean_fishing_low_options= input("\nYou float around until you come to a large river. Deciding this would be a good\nplace to stop and do some fishing for dinner tonight, you dig around for\nsome worms. You sit down and cast your line out. You catch a small amount\nof fish, and decide that is enough for you for the next day or so of\nmeals and move on to prepare the fish. You only caught what you needed, so\nyou were able to complete your task before any fish went to waste.\n\ntype (fish) to fish again\ntype (abandon) to abandon boat and return to shore :\n\n") if ocean_fishing_low_options == "": continue choices = { "return": ocean_1, "fish": ocean_fishing, "exit": lambda x,y,z,b: "exit" }; choice = choices.get(ocean_fishing_low_options, invalid_entry); result = choice(gold,skillz,deer,fish,result) def ocean_fishing_med(gold,skillz,deer,fish,result): fish = fish + 17 skillz = skillz - 5 print("\n\nCongrats you got 17 fish") print("you currently have\n",gold,"gold\n",deer,"deer\n",fish,"fish") result = "" while result != "exit" : ocean_fishing_options_med= input("\nCatch a moderate amount of fish, only lose some skills. You float around until you come to a large river. Deciding this would be a good\nplace to stop and do some fishing for dinner tonight, you dig around for\nsome worms. You sit down and cast your line out. You find the fish are biting really well today, and you catch quite a few fish. You start to feel tired, and\nupon counting the fish you have already caught, decide to finish up for the day. You let exhaustion overtake you and wake up to finding the boat heading\ntowards a large rock. Frantically you padel a different direction, but it\nstill exhausts you and leaves you panicked. \ntype (fish) to fish again\ntype (abandon) to abandon boat and return to shore :\n\n") if ocean_fishing_options_med == "": continue choices = { "abandon": ocean_1, "fish": ocean_fishing, "exit": lambda x,y,z,b: "exit" }; choice = choices.get(ocean_fishing_options_med, invalid_entry); result = choice(gold,skillz,deer,fish,result) def ocean_fishing_high(gold,skillz,deer,fish,result): fish = fish + 29 skillz = skillz - 15 print("\n\nCongrats you got 29 fish") print("you currently have\n",gold,"gold\n",deer,"deer\n",fish,"fish") result = "" while result != "exit" : ocean_fishing_high_options= input("\nYou float around until you come to a large river. Deciding this would be a good\nplace to stop and do some fishing for dinner tonight, you dig around for\nsome worms. You sit down and cast your line out. Either there are a lot of\nfish, or no one has fished here in a long time, because you catch fish after\nfish after fish. However, you forget to pace yourself and only take what you\nneed, so the sun beating down on you and the work of reeling in fish and casting the line wears you out to the point you fall asleep. You slept well into the\nnext day but wake up with sunburn, and still feel exhausted.\ntype (fish) to fish again\ntype (abandon) to abandon boat and return to shore :\n\n") if ocean_fishing_high_options == "": continue choices = { "abandon": ocean_1, "fish": ocean_fishing, "exit": lambda x,y,z,b: "exit" }; choice = choices.get(ocean_fishing_high_options, invalid_entry); result = choice(gold,skillz,deer,fish,result) def ocean_b_1_2(gold,skillz,deer,fish,result): skillz = skillz + 5 gold = gold - 15 print("\nThat dude was not happy that you took his boat.\nIf you had gold he took 15 of it.\nIf you didn't have gold you are now in debt\n") print("\nyou currently have\n",gold,"gold\n",deer,"deer\n",fish,"fish\n") result = "" while result != "exit" : ocean_b_1_2options = input("\ntype (return) to go back to the ocean shoreline") if ocean_b_1_2options == "": continue choices = { "return": ocean_1, "exit": lambda x,y,z,b: "exit" }; choice = choices.get(ocean_b_1_2options, invalid_entry); result = choice(gold,skillz,deer,fish,result) def ocean_b_1_3(gold,skillz,deer,fish,result): result = "" while result != "exit" : if skillz > 50: ocean_b_1_3_options = input("So, normally, you would have died trying to steal that boat and lost all of your inventory.\nFortunately for you, you had high enough skillz to make it through.\ntype (ok)\n\n") else: ocean_b_1_3_options = input("\nSorry, you died trying to capture that boat.\ntype (continue) to try this game again :\n\n") if ocean_b_1_3_options == "": continue choices = { "ok" : ocean_b_1_2, "continue" : player_death, "exit": lambda x,y,z,b: "exit" }; choice = choices.get(ocean_b_1_3_options, invalid_entry); result = choice(gold,skillz,deer,fish,result) def ocean_a_2(gold,skillz,deer,fish,result): skillz = skillz - 10 result = "" while result != "exit" : ocean_a_2_options= input("\nOh great, Now you have sunburn. Good job dude\ntype (return) :\n\n") if ocean_a_2_options == "": continue choices = { "return": ocean_a_1, "exit": lambda x,y,z,b: "exit" }; choice = choices.get(ocean_a_2_options, invalid_entry); result = choice(gold,skillz,deer,fish,result) def town_a_1(gold,skillz,deer,fish,result): skillz = skillz + 3 print("you currently have\n",gold,"gold\n",deer,"deer\n",fish,"fish\n") result = "" while result != "exit" : town_a_1_options= input("\nYou are at the merchant's place\ntype (sell) to sell all of your inventory.\ntype (work) to ask the merchant for work.\ntype (return) to return to the town :\n\n") if town_a_1_options == "": continue choices = { "sell": town_a_2, "work": town_merchant_work_1, "return": town_1, "exit": lambda x,y,z,b: "exit" }; choice = choices.get(town_a_1_options, invalid_entry); result = choice(gold,skillz,deer,fish,result) def town_merchant_work_1(gold,skillz,deer,fish,result): print("you currently have\n",gold,"gold\n",deer,"deer\n",fish,"fish\n") result = "" while result != "exit" : town_merchant_work_1_options = input("\nThe merchant pays a starting salary of 15 gold pieces per day.\nThis may go up or down depending on your current skill level.\ntype (yes) to work for the merchant.\ntype (no) to return to his shop :\n\n") if town_merchant_work_1_options == "": continue choices = { "no": town_a_1, "yes": town_merchant_work_2, "exit": lambda x,y,z,b: "exit" }; choice = choices.get(town_merchant_work_1_options, invalid_entry); result = choice(gold,skillz,deer,fish,result) def town_merchant_work_2(gold,skillz,deer,fish,result): fish = fish + 2 gold = gold + (15*(0.75+(skillz/100))) skillz = skillz + 13 print("you currently have\n",gold,"gold\n",deer,"deer\n",fish,"fish\n") result = "" #start(gold,skillz,deer,fish,"exit") if gold > 100: print("\n\n\nOMG you evil person.\nYou Beat my game!\n\n\n") time.sleep(2) youwin(gold) while result != "exit" : town_merchant_work_2_options = input("Congratulations. you have worked for the merchant.\nHe has given you gold pieces, and a couple fish just because he is generous\ntype (work) to work again\ntype (return) to return to his shop\n\n") if town_merchant_work_2_options == "": continueow choices = { "return": town_a_1, "work": town_merchant_work_2, "test": start, "exit": lambda x,y,z,b: "exit" }; choice = choices.get(town_merchant_work_2_options, invalid_entry); result = choice(gold,skillz,deer,fish,result) def town_a_2(gold,skillz,deer,fish,result): gold = ((deer * 30) + (fish * 0.75))*(0.75+(skillz/100)) + gold skillz = skillz + 30 fish = 0 deer = 0 print("You now have this much gold :",gold) result = "" if gold > 100: print("\n\n\nOMG you evil person.\nYou Beat my game!\n\n\n") time.sleep(2) youwin(gold) while result != "exit" : town_a_2_options= input("\nCongrats! You have sold all of your inventory and turned it into gold\ntype (return) to return to the town:\n\n") if town_a_2_options == "": continue choices = { "return": town_1, "exit": lambda x,y,z,b: "exit" }; choice = choices.get(town_a_2_options, invalid_entry); result = choice(gold,skillz,deer,fish,result) def town_b_1(gold,skillz,deer,fish,result): print("you currently have\n",gold,"gold\n",deer,"deer\n",fish,"fish\n") result = "" while result != "exit" : town_b_1_options = input("\nThis is the bar. You can spend money and drink here. But be warned. You can go into debt here\ntype (return) to return to town.\ntype (drink) to get a drink here\n\n") if town_b_1_options == "": continue choices = { "return": town_1, "drink": town_b_2, "exit": lambda x,y,z,b: "exit" }; choice = choices.get(town_b_1_options, invalid_entry); result = choice(gold,skillz,deer,fish,result) def town_b_2(gold,skillz,deer,fish,result): gold = gold - 10 skillz = skillz - 20 result = "" print("you currently have\n",gold,"gold\n",deer,"deer\n",fish,"fish\n") while result != "exit" : if skillz < 0: town_b_2_options = input("\nYou had a nice relaxing drink!\nyou do feel more confident if a bit tipsy\ntype (drink) to have another drink.\ntype (continue) to go back to the town\n\n") else: town_b_2_options = input("\nYou had a nice relaxing drink!\nyou do feel more confident if a bit tipsy\ntype (drink) to have another drink.\ntype (return) to go back to the town\n\n") if town_b_2_options == "": continue choices = { "continue":town_drunk_player, "return": town_1, "drink": town_b_2, "exit": lambda x,y,z,b: "exit" }; choice = choices.get(town_b_2_options, invalid_entry); result = choice(gold,skillz,deer,fish,result) def town_drunk_player(gold,skillz,deer,fish,result): result = "" while result != "exit" : town_drunk_player_options = input("\nUh oh. You aren't looking too good. Drinking maybe?\ntype (jail) to not resist the arrest.\ntype (resist) to resist the arrest\n\n") if town_drunk_player_options == "": continue choices = { "resist": town_d, "jail": town_j, "exit": lambda x,y,z,b: "exit" }; choice = choices.get(town_drunk_player_options, invalid_entry); result = choice(gold,skillz,deer,fish,result) def forest_a_1(gold,skillz,deer,fish,result): skillz = skillz + 1 result = "" print("you currently have\n",gold,"gold\n",deer,"deer\n",fish,"fish\n") while result != "exit" : forest_a_1_options= input("\nYou move deeper into the forest along the game trail,\nintently searching for a large game animal.\nAs you walk, you notice both deer and horse dung;\nboth are fresh enough to indicate that the animals are nearby.\nLight rain begins to fall\n\ntype (deer) to try and hunt the deer. \ntype (fire) to try and make a fire.\ntype (horse) to go after the horse\ntype (return) to head back out to the edge of the forest. :\n\n") if forest_a_1_options == "": continue choices = { "horse": forest_a_3, "deer": forest_a_2, "fire": forest_b_1, "return": forest_1, "exit": lambda x,y,z,b: "exit" }; choice = choices.get(forest_a_1_options, invalid_entry); result = choice(gold,skillz,deer,fish,result) def forest_a_2(gold,skillz,deer,fish,result): result = "" while result != "exit" : player_number= input("So you want to catch a deer huh? Well type a number 1-5:\n") val = int(player_number) my_rand = random.randint(1,5) weighted_number = val + my_rand if weighted_number == "": continue choices = { 2 : forest_a_2_2, 3 : forest_a_2_1, 4 : forest_a_2_2, 5 : forest_a_2_1, 6 : forest_a_2_2, 7 : forest_a_2_1, 8 : forest_a_2_2, 9 : forest_a_2_1, 10: forest_a_2_2, "exit": lambda x,y,z,b: "exit" }; choice = choices.get(weighted_number, invalid_entry); result = choice(gold,skillz,deer,fish,result) def forest_a_2_1(gold,skillz,deer,fish,result): deer = deer + 1 skillz = skillz + 30 result = "" print("you currently have\n",gold,"gold\n",deer,"deer\n",fish,"fish\n") while result != "exit" : forest_a_2_1_options= input("Okay. So you caught the deer.\ntype (return) to start leaving the forest\n\n") if forest_a_2_1_options == "": continue choices = { "return" : forest_1, "exit": lambda x,y,z,b: "exit" }; choice = choices.get(forest_a_2_1_options, invalid_entry); result = choice(gold,skillz,deer,fish,result) def forest_a_2_2(gold,skillz,deer,fish,result): result = "" print("you currently have\n",gold,"gold\n",deer,"deer\n",fish,"fish\n") while result != "exit" : if skillz < 10: forest_a_2_2_options = input("Well, that's one deer that won't be making it into the stew pot,\nand" + "you won't be making it back home either.\nAs you clumsily attempted to" + "bring the gigantic buck down,\nyou managed to stumble directly into a" + "giant hornet nest\nlodged in the crook of a fallen snag. Better luck next" + "time!\ntype (continue) to try and win this game one more time\n\n") else: skillz = skillz - 7 forest_a_2_2_options = input("You messed up on catching the deer. But no harm done. Doesn't hurt to try again\ntype (return) to go back to the hunting choice\n\n") if forest_a_2_2_options == "": continue choices = { "return" : forest_a_1, "continue" : player_death, "exit": lambda x,y,z,b: "exit" }; choice = choices.get(forest_a_2_2_options, invalid_entry); result = choice(gold,skillz,deer,fish,result) def forest_a_3(gold,skillz,deer,fish,result): result = "" print("you currently have\n",gold,"gold\n",deer,"deer\n",fish,"fish\n") while result != "exit" : player_number= input("\nSo you want to tame a horse? Type a number 1-5 :\n\n") val = int(player_number) my_rand = random.randint(1,5) weighted_number = val + my_rand if weighted_number == "": continue choices = { 2 : forest_a_3_2, 3 : forest_a_3_1, 4 : forest_a_3_3, 5 : forest_a_3_3, 6 : forest_a_3_2, 7 : forest_a_3_3, 8 : forest_a_3_1, 9 : forest_a_3_1, 10 : forest_a_3_2, "exit": lambda x,y,z,b: "exit" }; choice = choices.get(weighted_number, invalid_entry); result = choice(gold,skillz,deer,fish,result) def forest_a_3_1(gold,skillz,deer,fish,result): result = "" print("you currently have\n",gold,"gold\n",deer,"deer\n",fish,"fish\n") while result != "exit" : if skillz > 20: forest_a_3_1_options= input("\nAs the clouds grew darker and more ominous, the horse in front of you became\n" + "restless; there was a strange electricity in the air that made the hair on\nthe back" + "of your neck stand up. Loud thunder boomed in the distance, and you\ndecided that now was" + "a better time to attempt to capture the horse. You jump up from your hiding spot in the tall grass" + "and successfully land on the horses\nback; It reared and tried to buck you off, but because of your" + "quick thinking and dexterity you were able to stay on. A lightning bolt struck near where\nyou had been" + "hiding only seconds ago, and your newly caught steed\n galloped away with you safely on its back" + "\ntype(forest) to return to the forest\n\n") else: forest_a_3_1_options= input("\nAs the clouds grew darker and more ominous, the horse in front of you became restless; there was a strange\n" + "electricity in the air that made the hair on the back of your neck stand up. Loud thunder boomed in the distance,\n" + "and a lightning bolt struck near your hiding place in the tall grass. Flames engulfed your surroundings, and the\n" + "horse that you had your eyes on reared up and galloped away. You sadly couldn't find an escape from the flames that\n" + "the lightning caused.\n\ntype (continue) to try playing the game again\n\n") if forest_a_3_1_options == "": continue choices = { "continue" : player_death, "forest" : forest_1, "exit": lambda x,y,z,b: "exit" }; choice = choices.get(forest_a_3_1_options, invalid_entry); result = choice(gold,skillz,deer,fish,result) def forest_a_3_2(gold,skillz,deer,fish,result): skillz = skillz + 50 deer = deer + 1 result = "" print("you currently have\n",gold,"gold\n",deer,"deer\n",fish,"fish\n") while result != "exit" : forest_a_3_2_options= input("\nCongratulations. You got the horse.\nYou have increased your skillz so will find the " + "game a little easier now\ntype (continue) to return to the forest.\ntype (merchant) to " + "return directly to the merchant\n\n") if forest_a_3_2_options == "": continue choices = { "continue" : forest_1, "merchant" : town_a_1, "exit": lambda x,y,z,b: "exit" }; choice = choices.get(forest_a_3_2_options, invalid_entry); result = choice(gold,skillz,deer,fish,result) def forest_a_3_3(gold,skillz,deer,fish,result): result = "" skillz = skillz + 3 print("you currently have\n",gold,"gold\n",deer,"deer\n",fish,"fish\n") while result != "exit" : if skillz > 50: forest_a_3_3_options= input("\nWell you almost failed in capturing the horse. But thankfully your skillz were high enough that you made it out\ntype (success) to claim your horse\n\n") else: fish = fish + 3 forest_a_3_3_options= input("\nSorry, you failed in catching the horse.\nA passerby felt bad for you and gave you 3 fish though" + "\ntype (continue) to return to the forest.\n\n") if forest_a_3_3_options == "": continue choices = { "success" : forest_a_3_2, "continue" : forest_1, "exit": lambda x,y,z,b: "exit" }; choice = choices.get(forest_a_3_3_options, invalid_entry); result = choice(gold,skillz,deer,fish,result) def forest_b_1(gold,skillz,deer,fish,result): result = "" while result != "exit" : player_number= input("\nyou made a fire?\nseriously?\nall of the bandits could see you from miles away!\nspeak" + "of the devil there's one coming right now\nenter a number between 1-5 to see if you survive\n\n") val = int(player_number) my_rand = random.randint(1,5) weighted_number = val + my_rand if weighted_number == "": continue choices = { 2 : forest_bandit_live, 3 : forest_bandit_die, 4 : forest_bandit_live, 5 : forest_bandit_die, 6 : forest_bandit_live, 7 : forest_bandit_die, 8 : forest_bandit_live, 9 : forest_bandit_die, 10 : forest_bandit_live, "exit": lambda x,y,z,b: "exit" }; choice = choices.get(weighted_number, invalid_entry); result = choice(gold,skillz,deer,fish,result) def forest_bandit_die(gold,skillz,deer,fish,result): skillz = skillz + 7 forest_bandit_die_options = input("You set up your camp for the evening and wandered out into the woods\nto gather some firewood." + "You come back to find\nsomeone looting your food and belongings, and you announce\nyourself hoping" + "to scare him away. Instead,\nhe attacks you and knocks you out.\nYou come to, tied to a tree with a" + "piece of ripped clothing in\nyour mouth so no one hears you.\ntype (continue) to try your hand at" + "this game again\n\n") { "continue": player_death }.get(forest_bandit_die_options, invalid_entry)(gold,skillz,deer,fish,result) def forest_bandit_live(gold,skillz,deer,fish,result): skillz = skillz - 10 gold = gold - 20 result = "" print("you currently have\n",gold,"gold\n",deer,"deer\n",fish,"fish\n") while result != "exit" : forest_bandit_live_options = input("You set up your camp for the evening, eat your dinner\nby the fire and crawl " + "into your tent to sleep.\nNot really thinking, you leave your food and belongings" + "sitting in your pack\noutside the tent. You drift off to sleep, snoring like a train," + "\nand completely miss hearing a bandit enter your campsite and loot\nyour remaining food " + "and belongings. You awake the next morning, alive but with 20 less\ngold than you had" + "before and a little shaken up.\nIf you had no gold then you are now in debt\ntype" + "(continue) to keep playing\n\n") if forest_bandit_live_options == "": continue choices = { "continue" : forest_1, "exit": lambda x,y,z,b: "exit" }; choice = choices.get(forest_bandit_live_options, invalid_entry); result = choice(gold,skillz,deer,fish,result) def player_death(gold,skillz,deer,fish,result): skillz = skillz + 1 print("You died. No worries. You get to start again. Skills intact, but no inventory\n") time.sleep(1.5) gold = 0 skillz = skillz deer = 0 fish = 0 choice_2(gold,skillz,deer,fish,result) def forest_1(gold,skillz,deer,fish,result): skillz = skillz + 1 print("you currently have\n",gold,"gold\n",deer,"deer\n",fish,"fish\n") result = "" while result != "exit" : forest_1_options= input("\nYou are now standing at the edge of the forest.Gray light from an overcast sky filters down\n" + "through the canopy of trees,and a chilly breeze blowing in off of the beach causes the leaves to\n" + "rustle overhead. You notice squirrels scampering about the branches, and a faintly\ndefined game trail" + "disappears into the undergrowth ahead of you\n\ntype (hunt) to go hunting.\ntype (fire) to make a fire\ntype" + "(return) to go to the game's starting place\n\n") if forest_1_options == "": continue choices = { "hunt": forest_a_1, "return": choice_2, "fire": forest_b_1, "exit": lambda x,y,z,b: "exit" }; choice = choices.get(forest_1_options, invalid_entry); result = choice(gold,skillz,deer,fish,result) def town_1(gold,skillz,deer,fish,result): result = "" print("you currently have\n",gold,"gold\n",deer,"deer\n",fish,"fish\n") while result != "exit" : town_1_options= input("\nYou are now at the edge of town\ntype (return) to go to the beginning of the" + "game\ntype (merchant) to talk to the merchant\ntype (bar) to go to the bar :\n\n") if town_1_options == "": continue choices = { "merchant": town_a_1, "return": choice_2, "bar": town_b_1, "exit": lambda x,y,z,b: "exit" }; choice = choices.get(town_1_options, invalid_entry); result = choice(gold,skillz,deer,fish,result) def town_d(gold,skillz,deer,fish,result): result = "" while result != "exit" : town_d_options= input("\nSince you are not in the right frame of mind,\nyou argue with the sheriff" + "and eventually throw a punch.\nDuring the scuffle, you manage to get away from " + "the sheriff and you run away into the\nforest on the edge of the town. The sheriff" + "then calls a\nmanhunt for you, which ultimately leads to your death when you try to\noutfox" + "the people searching for you and you misstep, falling into a ravine.\ntype (continue) " + "to try playing this game again\n\n") if town_d_options == "": continue choices = { "continue": player_death, "exit": lambda x,y,z,b: "exit" }; choice = choices.get(town_d_options, invalid_entry); result = choice(gold,skillz,deer,fish,result) def town_j(gold,skillz,deer,fish,result): skillz = 0 gold = gold - 20 result = "" while result != "exit" : town_j_options= input("\nYou spent the night in jail. You are feeling much better physically though." + "You were fined 20 gold though\ntype (continue) to return to the town\n\n") if town_j_options == "": continue choices = { "continue": town_1, "exit": lambda x,y,z,b: "exit" }; choice = choices.get(town_j_options, invalid_entry); result = choice(gold,skillz,deer,fish,result) def not_yet_implemented(gold,skillz,deer,fish,result): print("\nThis option under development.:(") def invalid_entry(gold,skillz,deer,fish,result): print("\nInvalid entry please try again.") def ocean_1(gold,skillz,deer,fish,result): skillz = skillz + 1 result = "" while result != "exit" : ocean_1_options= input("\nCongrats! You are now at the ocean's shore\ntype (return)" + "to go back to the game's starting place\ntype (raft) to steal a " + "raft\ntype (boat) to steal a boat :\n\n") if ocean_1_options == "": continue choices = { "raft": ocean_a_1, "return": choice_2, "boat": ocean_b_1, "exit": lambda x,y,z,b: "exit" }; choice = choices.get(ocean_1_options, invalid_entry); result = choice(gold,skillz,deer,fish,result) def choice_2(gold,skillz,deer,fish,result): result = "" while result != "exit" : beginningQuestion= input("Would you like to go to the forest, town, or the ocean? \n\n") if beginningQuestion == "": continue choices = { "forest": forest_1, "town": town_1, "ocean": ocean_1, "exit": lambda x,y,z,b: "exit" }; choice = choices.get(beginningQuestion, invalid_entry); result = choice(gold,skillz,deer,fish,result) def youwin(gold): print("\n\n\nBye bye now!!! Leave here and go play") time.sleep(3) os._exit(1) def start(gold,skillz,deer,fish,result): gold = 0 skillz = 0 fish = 0 deer = 0 while result != "exit" : beginningQuestion= input("Would you like to go to the forest, town, or the ocean? \n\n") if beginningQuestion == "": continue choices = { "forest": forest_1, "town": town_1, "ocean": ocean_1, "exit": lambda x,y,z,b: "exit" }; choice = choices.get(beginningQuestion, invalid_entry); result = choice(gold,skillz,deer,fish,result) start(0,0,0,0,"")

Compiling Program...

Command line arguments:
Standard Input: Interactive Console Text

                

                

Program is not being debugged. Click "Debug" button to start program in debug mode.

#FunctionFile:Line
VariableValue
RegisterValue
ExpressionValue