|
| 1 | +import time |
| 2 | +import random |
| 3 | +from string import ascii_lowercase |
| 4 | + |
| 5 | +print('This is a game where you guess the randomly chosen word and if you win, you get a randomly generated short story !') |
| 6 | +print('Enjoy !!') |
| 7 | +print('\n') |
| 8 | + |
| 9 | +time.sleep(4) |
| 10 | + |
| 11 | +name=input('Player Name :- ') |
| 12 | +print('\n') |
| 13 | +print('Welcome ' + name + '. Let''s play Hangman') |
| 14 | +print('') |
| 15 | + |
| 16 | +time.sleep(1) |
| 17 | + |
| 18 | +friends=['Chandler','Joey','Monica','Rachel','Ross','Phoebe','Gunther','Janice','Ugly Naked Guy','Mr Heckles','Judy','Jack'] |
| 19 | +ramaayan=['Shri Ram','Sita maa','Lakshman','Bharat','Raavan','Hanuman','Maarich','Dashrath','Kaikeyi','King Janak','KumbhKarn','Baali'] |
| 20 | +Got=['Theon','Danaerys','Jon Snow','Joeffry','Cersie','Tyrion','Drogon','Baratheon','Starks','Greyjoy','Viserys'] |
| 21 | + |
| 22 | +print('Choose Category :- ') |
| 23 | +choose=int(input('1. F.R.I.E.N.D.S 2. Game Of Thrones 3. Ramaayan ')) |
| 24 | +if choose==1: |
| 25 | + word=random.choice(friends) |
| 26 | +elif choose==2: |
| 27 | + word=random.choice(Got) |
| 28 | +elif choose==3: |
| 29 | + word=random.choice(ramaayan) |
| 30 | + |
| 31 | +print('HINT : Starts with' + word[0]) |
| 32 | +print('\n') |
| 33 | +print("Start guessing...") |
| 34 | +time.sleep(0.5) |
| 35 | +guess='' |
| 36 | +turn=10 |
| 37 | + |
| 38 | +while turn>0: |
| 39 | + fail=0 |
| 40 | + for c in word: |
| 41 | + if c in guess: |
| 42 | + print(c) |
| 43 | + else: |
| 44 | + print('_') |
| 45 | + fail+=1 |
| 46 | + if fail==0: |
| 47 | + print('You Won ' + name + ' !') |
| 48 | + print('\n') |
| 49 | + print('Here is your story - ') |
| 50 | + theme=random.choice(["real world","high fantasy","space sci-fi","alt-history","cyberpunk"]) |
| 51 | + if theme == "real world": |
| 52 | + subsetting=random.choice(["the Ayodhya","Kishkindha","Lanka","Panchvati","Janakpuri"]) |
| 53 | + setting=random.choice(["a small town in ","a big city in ","a farm in ","a school in ","the ocean","the entire world"]) |
| 54 | + if setting != "the ocean" or "the entire world": |
| 55 | + setting=setting+subsetting |
| 56 | + age=random.choice(["newborn ","toddler ","child ","teenager ","young adult ","adult ","middle aged ","elder "]) |
| 57 | + race=random.choice(["ayodhyan ","janakis ","lankan ","indian "]) |
| 58 | + gengender=random.randint(0,100) |
| 59 | + if gengender <= 10: |
| 60 | + gender = ("transgender ") |
| 61 | + if gengender >= 9: |
| 62 | + if gengender >= 47: |
| 63 | + gender = ("male ") |
| 64 | + if gengender <= 46: |
| 65 | + gender = ("female ") |
| 66 | + protagonist=age+race+gender |
| 67 | + antagonist=random.choice(["a female","a male","a king","a government","a tragic event","traffic","religion","a disease","a rival","the law","an old friend","a dog"]) |
| 68 | + if theme == "high fantasy": |
| 69 | + setting=random.choice(["The Great Empire","a vast desert","a dark corrupted land","a magic swamp","a unending labryinth","floating islands","a mystical forest","a frozen wasteland","a dangerous jungle land"]) |
| 70 | + gender=random.choice(["male ","male ","male ","female ","female ","female ","magical transgender ","agender ","third gender "]) |
| 71 | + race=random.choice(["human ","human ","elf ","orc ","dwarf ","gnome ","demon ","angel ","kitsune ","dark elf ","troll ","unicorn "]) |
| 72 | + classs=random.choice(["marksmen ","warrior ","wizard ","bard ","thief ","merchant","knight ","spellsword ","peasant ","necromancer ","preist ","bandit ","monarch"]) |
| 73 | + protagonist = gender+race+classs |
| 74 | + antagonist=random.choice(["a female","a male","an entire race","a god","an evil mage","an order of knights","evil itself","a giant","an invading army","a tyrant","magic","a greedy merchant","a monster","a dragon"]) |
| 75 | + if theme == "space sci-fi": |
| 76 | + setting=random.choice(["the deep void of space","an asteroid belt","an ice planet","a lava planet","a gas giant","an alien home world","future Earth","another galaxy, far far away","the multiverse"]) |
| 77 | + protagonist=random.choice(["human","robot","hive mind","alien","alien","blob","human"]) |
| 78 | + antagonist=random.choice(["a female","a male","an entire alien race","a starfleet","an alien","an artifical intellgence","a galactic federation","a glitch in space-time","an invading army","a incredibly infectious space fungus","the limits of science","a robot"]) |
| 79 | + if theme == "alt-history": |
| 80 | + setting=random.choice(["America","Religion","the Classical Era","the Middle Ages","the Renaissance","the Industrial Era","World War I","World War II","the Modern Era"]) |
| 81 | + if setting == "America": |
| 82 | + figures=["Abraham Lincoln","George W. Bush Jr.","Benjamin Franklin","Donald Trump","Ronald Reagan","John Adams","Hilary Clinton","King George III","King George Washington","Andrew Jackson","Thomas Edison","Steve Jobs"] |
| 83 | + figure=random.choice(figures) |
| 84 | + antagonist=random.choice(figures) |
| 85 | + if setting == "Religion": |
| 86 | + figure=random.choice(["Jesus","Muhammad","Buddha","Krishna","Moses","L. Ron Hubbard","Joseph Smith","Zeus","Ra","Thor"]) |
| 87 | + antagonist=random.choice(["Christianity","Islam","Hinduism","Buddhism","Greek mythology","Scientology","the Mormons","Paganism","Heresies"]) |
| 88 | + if setting == "the Classical Era": |
| 89 | + figures=["Alexander The Great","Julius Caesar","Aristotle","King Tut","Qin Shi Huang","Homer","Augustus","Plato","Cleopatra","Ashoka","Attila the Hun","Leonidas"] |
| 90 | + figure=random.choice(figures) |
| 91 | + antagonist=random.choice(figures) |
| 92 | + if setting == "the Middle Ages": |
| 93 | + figures=["Charlemagne","Ghenghis Khan","Saladin","William the Conqueror","Ragnar Lodbrok","Oda Nobunaga","King Richard III","William Wallace","El Cid","Eleanor of Aquitaine","Erik the Red","Vlad the Impaler"] |
| 94 | + figure=random.choice(figures) |
| 95 | + antagonist=random.choice(figures) |
| 96 | + if setting == "the Renaissance": |
| 97 | + figures=["Marco Polo","Joan of Arc","Christopher Columbus","Blackbeard","Leonardo da Vinci","William Shakespeare","Henry VIII","Michelangelo","Donatello","Galileo","Admiral Yi Sun-sin","Suleiman the Magnificent"] |
| 98 | + figure=random.choice(figures) |
| 99 | + antagonist=random.choice(figures) |
| 100 | + if setting == "the Industrial Era": |
| 101 | + figures=["Henry Ford","Karl Marx","Charles Dickens","John D. Rockefeller","Thomas Edison","Nikola Tesla","Amelia Earheart","Frank C. Mars","Albert Einstein","Napoleon","Ghandi","Mark Twain"] |
| 102 | + figure=random.choice(figures) |
| 103 | + antagonist=random.choice(figures) |
| 104 | + if setting == "World War I": |
| 105 | + figure=random.choice(["Woodrow Wilson","Winston Churchill","Tsar Nicholas II","Lenin","Paul von Hindenburg","Ataturk"]) |
| 106 | + antagonist=random.choice(["the Ottoman Empire","Germany","the United States","Britain","Austria-Hungary","France"]) |
| 107 | + if setting == "World War II": |
| 108 | + figure=random.choice(["Hitler","Queen Elizabeth","Franklin D. Roosevelt","Joseph Stalin","Harry Truman","General Hideki Tojo"]) |
| 109 | + antagonist=random.choice(["the United States","Germany","the Soviet Union","the United Kingdom","Japan","Italy"]) |
| 110 | + if setting == "the Modern Era": |
| 111 | + figures=["Obama","Putin","Kim Jong-un","Kanye West","Bill Gates","Guido van Rossum","The Beatles","ISIS","Pope Francis","Mike Tyson","Pewdiepie","Hilary Cliton"] |
| 112 | + figure=random.choice(figures) |
| 113 | + antagonist=random.choice(figures) |
| 114 | + afigure=("figure known as ") |
| 115 | + protagonist= afigure+figure |
| 116 | + if theme == "cyberpunk": |
| 117 | + setting=random.choice(["high-tech Tokyo","New New York","a dystopia","a utopia","a computer simulation","the SuperWeb","Mega Silicon Valley","an underwater city","an extensive underground facility"]) |
| 118 | + gender=random.choice(["male ","male ","female ","female ","robogender ","unigender ","agender ","mega genderfluid ","third gender "]) |
| 119 | + classs=random.choice(["hacker","cyborg","DJ","technopath","engineer","bomber","corporate","street rat","anarchist"]) |
| 120 | + protagonist=gender+classs |
| 121 | + antagonist=random.choice(["a large corporation","an evil AI","Python","a gang","a secret society","a new technology","robots","internet trolls","the most powerful cyborg"]) |
| 122 | + conflict=random.choice(["fell in love with ","fought against ","attempted to stop ","defended against ","tried to befriend ","explored with ","tried to evade ","competed with ","exceeded beyond ","sought revenge against "]) |
| 123 | + end=random.choice(["It did not end well.","It ended very well.","Died tragically.","Lived happily ever after.","It ended sadly.","It was glorious.","In the end, nothing changed.","It ended with a twist.","Gave up."]) |
| 124 | + print("In the",theme,"setting of",setting,", there was a", protagonist, "who",conflict,antagonist,".",end) |
| 125 | + |
| 126 | + break |
| 127 | + |
| 128 | + |
| 129 | + |
| 130 | + guesses=input('Guess a character :- ') |
| 131 | + guess=guess+guesses |
| 132 | + if guesses not in word: |
| 133 | + turn-=1 |
| 134 | + print('Wrong. You have ' + str(turn) + ' more guesses.') |
| 135 | + if turn==0: |
| 136 | + print('You lose ! The word was ' + word + '. Sorry, you don''t get the story.') |
| 137 | + print('\n') |
| 138 | + print('Write your story on your own.') |
| 139 | +#Winstoryhangman |
0 commit comments