Stupid method of learning Python Lesson 43

Source: Internet
Author: User

My little game to be continued

# -*- coding:utf-8 -*-def start ():     print u "You were drunk last night, Woke up to find lying in a strange place, not like a friend sent to the hotel. This horrible room must not be a place to stay. "    print u" You must flee this House. "    print " Are you ready? here wo go. "     game_start = beginroom ()     game_start.enter () def  Game_over (reason =  ""):     print reason, u "You're dead, start again, you tart!" \n\n\n\n\n\n\n\n "    start () def input_right ():     print u" A day Thunder split, dropped a piece of yellow paper. "    print u" on the yellow paper: "It doesn't make sense to see the words alive, does it?" "    game_over () Class beginroom (object):         def enter (self):         print u "You stared at the square in horror, and the room was empty, There is only one big closet, one table and some food on the table. You've been in a coma for a few days and you're starving. When you were about to pick up the food and eat it, you saw a note next to it. The note was full of words. "        &NBsp;       print u "The front of the note is:"          print  "-"  * 20        print u "welcome you! You are the sixth one to come here. As a master, I need to prepare things for my guests. This food is a bit of a point to me. "        print u" Eat Now, you must be very hungry. \ nyou have the strength to go home. And, remember, there's something scary outside the house, don't go out. Somebody's going to save you! "        print u" \t\t\t--Master "         print u "The opposite of the note is:"         print  "-"  * 20          print u "The positive words are false! Don't trust him! \ n Run, there's a passageway in the closet! \ nthe food is poisoned, you eat it, you die! \ n Don't stay indoors, there will be zombies around you in a moment! "        print u" \t\t\t--"No celebrities"                  your_choice = raw_input ("Which do you believe?") The front is 1 opposite is 2, choose who to believe? Think clearly, oh, this is not a toss of the fun yo \ \ \ \ \ \ \ \ \ \ n "                                .decode ("Utf-8"). Encode ("GBK"))                                           if your_choice ==  "1":              print u "You ate the food with a heartless diet. "            game_over (U" food is very tasty, the problem is poison.) ")         elif your_choice == " 2 ":             print u "You trembled and opened the closet, and sure enough, you saw a secret road. "            print u" you walk carefully into the secret road, afraid of something horrible attack. "   &NBsp;        secret_channel = secretchannel ()              secret_channel.enter ()          else:            input_ Right ()             class secretchannel (object ):         def enter (self):         print u "There are three rooms in the secret tunnel. The room on the left was locked, the door in the middle was open, and the door on the right was ajar. The scent of flowers came from the door to the left of "        print u". In the middle of the house is empty, there is a window, window glass into the sun. \ n There is a secret lane in the door to the right, but it is eerie. "        print u" is also the time to make a choice, this time to choose Which? Be careful, yo. "        your_choice = raw_input (" left input 1, middle input 2, right input 3 ". Decode ( "Utf-8"). Encode ("GBK"))         if your_choice ==  "1":             print u " You chose the left, but you couldn't open the door. When you are struggling or helpless, a zombie suddenly emerges from behind you. "             game_over (U) If you have peas, you can't help thinking. ")         elif your_choice == " 2 ":             print u "You chose the middle, but found the door and suddenly jumped out of a zombie." "            game_over (U) If you have peas, you can't help thinking. ")         elif your_choice == " 3 ":             print u "You chose the right side, the courage is commendable!" "            print u" You touch the black to go forward, do not know where to go, suddenly, A dim light is on, the lamp is a signpost, a finger to the left, a finger to the right. Unconsciously, you have reached the other end of the room. "            print u" You have no clue to look at the left and right sides. LeftThere are a few lights, do not know where to. There is no light on the right, it is endless darkness. Maybe a zombie is waiting to eat you! "            print u" you vaguely see the right end is a door, maybe can escape! "            print u" but it's too risky! You hesitate. "            print u" but standing here is definitely not going to work, you're thinking, it's time to make a decision. "            second_room = secondroom ()             second_room.enter ()          else:             Input_right () Class secondroom (object):         def enter (self ):         print u "to the left or to the right?" Throw a coin, please. I will go to the left to lose 1, on the opposite side I go to the right to lose 2. "        your_choice = raw_input (" >  ")         if your_choice ==  "1":             print u "You have always been afraid of the dark, there is a path of light, you did not hesitate to run over." "            print u" Just when you think you can run, the lights are off, You feel your throat is getting tighter with the rope-like stuff until you lose consciousness. "            game_over ()          elif your_choice ==  "2":             print u "You are afraid of the dark, go to the left corridor secretly took a lamp, turned and ran to the right, until a door." "            print u" written in front of: I have three love my daughter, Their age adds up to 13, and their age is the same as my age. They only have one hair that is black. "            print u" I have a loyal housekeeper, and he knows my age, But I'm not sure about the age of my three daughters. He is interested to know the age of my oldest daughter. Can you help him? "            guess_age ()         else:             Input_right () def guess_age ():     your_choice = raw_input ("Do you want to help him?") Help him, enter 1, otherwise, enter 2 try to see if you can ignore him go straight. ". Decode (" Utf-8 "). Encode (" GBK "))     if your_choice == " 1 ":         print u "It's a good boy's paper. "        print u" Come, help my poor housekeeper, he is going to be driven crazy by this problem. "        print u" success, I will reach your wish Oh ~          i = 1        while True:             your_guess = raw_input ("> ")             if your_guess ==  "9":                  print u "Wow! It's,%d  time to guess! "                print u" Today I am in a good mood, to realize your wish. Close your eyes,                 print.  u "You shut your eyes involuntarily, but you feel like the wind is blowing in your ears." "                print u" When you open your eyes, found already lying in the home sofa, just everything, as if all is a dream, but so true. "                break              elif your_guess.isdigit ():                 print u "You guessed it wrong, oh, Go on, you old tart. "                i +=  1            eLse:                print  u "Enter the numbers ah, the poor housekeeper wants to know the age of my oldest daughter." "                elif  your_choice ==  "2":         print u "I didn't think you were so cold-blooded!" So what does it mean to live in the world? "        game_over (U" Suddenly, a bunch of zombies coming up behind You ")          start ()


Stupid method of learning Python Lesson 43

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.