Created
April 20, 2015 17:43
-
-
Save carlynorama/607a1a58d9935f06df10 to your computer and use it in GitHub Desktop.
Knock Knock Joke Teller, Draft messing around with python. Didn't want to write a text game. Rough state.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Canoe Canoe come out and play with me today? | |
| Lettuce Lettuce in, it's cold out here. | |
| Honey bee Honey bee a dear and get me some juice. | |
| Wooden shoe Wooden shoe like to hear another joke? | |
| A broken pencil Oh never mind it's pointless. | |
| Cow says No silly, a cow says Mooooo! | |
| Double W! | |
| Mikey Mikey doesn't fit in the keyhole! | |
| Atch Bless you! | |
| I am You don't know who you are? | |
| Ya Wow, I'm excited to see you too. | |
| Figs Figs the doorbell, it's broken! | |
| Boo Don't cry, it's just me. | |
| Iva I've a sore hand from knocking! | |
| Avenue Avenue knocked on this door before? | |
| A little old lady I didn't know you could yodel. | |
| Doughnut Doughnut ask, it's a secret. | |
| Justin Justin time for lunch. | |
| Broccoli Broccoli doesn't have a last name, silly. | |
| Figs Figs the doorbell, it's broken! | |
| Cash I knew you were a nut! | |
| Olive Olive right next to you. | |
| Olive Olive you. | |
| Orange Orange you glad I'm here? | |
| Dishes Dishes me, who are you? | |
| Who Are you an owl? | |
| Cowsgo No they don't, cowsgo moo. | |
| Kook! Don't call me cuckoo! | |
| Boo Don't cry, it's just me. | |
| Abby Abby birthday to you. | |
| Tarzan Tarzan stripes forever. | |
| Doris Doris locked, that's why I knocked. | |
| Avenue Avenue heard this joke before. | |
| Water Water way to answer the door! | |
| Leaf Leaf me alone! | |
| Cargo Car go "Beep beep"! | |
| Dewey Dewey have to keep telling silly jokes. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #from sys import exit | |
| import csv | |
| from random import shuffle | |
| ##### SETUP ####### | |
| #load the jokes into an array and shuffle | |
| lol = list(csv.reader(open('jokes.txt', 'rb'), delimiter='\t')) | |
| shuffle(lol) | |
| ##### main loop defined ###### | |
| def main(): | |
| #get the last one on the list | |
| new_joke = lol.pop() | |
| currentJoke = Joke(new_joke[0], new_joke[1]) | |
| currentJoke.tell() | |
| ##### TODOLIST | |
| #Joke and Joke Engine? | |
| #Different Joke Types? | |
| #Better intros and segues | |
| #More lines for failed inputs | |
| #ability to close out / escape joke hell. | |
| class Joke(object): | |
| call_1 = "Knock Knock" | |
| response1_set = {"Who's there?", "whos there?", "who's there?", "To whom am I speaking?", "whos there", "wt"} | |
| def __init__(self, visitor, punchline): | |
| #print "This joke is not yet configured. Subclass it and implement enter()." | |
| self.visitor = visitor | |
| self. punchline = punchline | |
| #exit(1) | |
| def tell(self): | |
| print self.call_1 | |
| response = raw_input("> ") | |
| while not (response in self.response1_set): | |
| print "Come on, you know what I want you to say!" | |
| response = raw_input("> ") | |
| print "{}.".format(self.visitor) | |
| response = raw_input("> ") | |
| response2_set = "%s who?" % self.visitor | |
| while not (response == response2_set): | |
| print "Shheeeeshhhh... you're supposed to say \"%s who?\"!!! Try again." % self.visitor | |
| response = raw_input("> ") | |
| print "{}".format(self.punchline) | |
| ##### main loop ###### | |
| while True: | |
| main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Errors in the code