Advertisement
Guest User

Untitled

a guest
Dec 22nd, 2014
162
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 11.32 KB | None | 0 0
  1. #!/usr/bin/python
  2. import random
  3.        #[ 1, 2, 3,04,05,06,07,08,09,10,11,12,13,14,15,16,17,18,19,20,21,22,23]
  4. maze = [[ 0,18, 1, 1, 7, 1, 1, 1, 1, 1, 1, 6, 7, 6, 2, 2, 6, 2, 2, 2, 2, 2, 2],
  5.         [ 6, 6, 1, 1, 1, 1, 1, 1, 1, 6, 1, 1, 1, 6, 2, 2, 2, 2, 2, 6, 2, 2, 2],
  6.         [ 1, 1, 1, 1, 1, 1, 7, 6, 1, 6, 9, 1, 6, 6, 2, 2,16,16,16, 6, 2, 2, 2],
  7.         [ 6, 1, 6, 6, 1, 1, 6,14,14, 1, 1, 1, 1, 6, 7, 2,16,16,16, 6, 7, 2, 2],
  8.         [ 9, 1, 1, 1, 1, 1, 1,14,14, 1, 6, 6, 1, 6, 2, 2, 2, 2, 2, 6, 2,11, 2],
  9.         [ 1, 6, 1, 1, 1, 1, 1, 6, 6, 1, 1, 1, 1, 6, 2,11, 6, 2, 2, 6, 2, 2, 2],
  10.         [ 1, 6, 1, 1, 7, 1, 1, 1, 1, 1, 7, 1, 1, 6, 2, 2, 2, 7, 2, 6, 6, 6, 6],
  11.         [ 1, 1, 1, 6, 6, 6, 1, 8, 1, 1, 6, 1, 1, 6, 6, 6, 6, 6, 2, 2, 6, 8, 6],
  12.         [ 3, 3, 6, 6, 6, 3, 1, 1, 7, 1, 1, 7, 1, 6, 3, 3, 3, 6, 2, 2, 6, 2, 6],
  13.         [ 6, 3, 3, 3, 3, 3, 7, 1, 1, 1, 1, 1, 1, 6, 6, 6, 7, 6, 2, 2, 6, 2, 6],
  14.         [ 3, 6, 6,19, 3, 3, 1, 6, 1, 1,13,12,12, 6, 3, 3, 3, 6, 2, 2,11, 2, 6],
  15.         [ 3, 3, 3, 3, 6, 3, 7, 1, 1, 1,13,13,12, 6, 3, 6, 3, 2,20, 2, 2, 2, 2],
  16.         [ 3, 3, 3, 3, 6, 3, 6, 1, 6, 1, 1, 1, 6, 6, 3, 3, 3, 6, 2, 2, 6, 6, 6],
  17.         [ 3, 7, 3, 3, 6, 3, 3, 7, 6, 3, 3, 3, 6, 3, 3, 7, 3, 6, 6, 2, 2, 7, 2],
  18.         [22,23,22,22, 6, 6, 6, 6, 6, 6, 6, 6, 6, 3, 3, 3, 3, 2,20, 2, 2, 2, 2],
  19.         [22,10,22,23, 3, 3, 3, 8, 3, 3, 3, 6, 3, 3, 6, 3, 3, 6,11, 2, 6, 6, 6],
  20.         [22,23,22,23, 3, 3, 3, 3, 3, 3, 3, 6, 3, 7, 3, 3, 3, 6, 2, 2, 2, 2, 2],
  21.         [10,22,23,10, 3,24,24,24,24,25, 3, 6, 3, 3, 3, 6, 6, 6, 7, 2, 2, 2, 2],
  22.         [ 3, 3, 3, 3, 3,24,24,24,24,24, 3, 3, 3, 3, 3, 3, 3, 6, 6, 6, 6, 6, 6],
  23.         [ 6, 6, 6, 3, 3,24,24,25,24,24, 7, 3, 3, 3, 3, 3, 3, 6,17,17,17,17,17],
  24.         [ 3, 7, 3, 3, 3,24,24,24,24,25, 3, 6, 3, 3,15,15,15, 6,17,17,17,17,17],
  25.         [ 3, 3, 3, 6, 3,24,25,24,24,24, 3, 6, 3, 3,15,15,15, 6, 4, 4, 7, 4, 4],
  26.         [ 6, 4, 4, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 4, 4, 4, 4, 4],
  27.         [21, 4, 6, 4, 4, 7, 4, 4, 6, 4, 4, 7, 4, 6, 6, 6, 6, 6, 6, 4, 6, 6, 6],
  28.         [ 4, 6, 6, 4, 6, 6, 6, 4, 6, 6, 6, 6, 4, 4, 4, 7, 4, 4, 4, 4, 6, 6, 6],
  29.         [ 4, 4, 4, 4, 4, 6, 4, 4, 4, 4, 4, 6, 4, 6, 6, 4, 4, 6, 6, 6, 6, 6, 6],
  30.         [ 6, 6, 6, 6, 4, 6, 4, 6, 6, 6, 4, 6, 4, 6, 4, 5, 6, 6, 6, 6, 6, 6, 6],
  31.         [ 4, 4, 4, 7, 4, 6, 7, 6, 4, 4, 7, 6, 4, 6, 7, 6, 5, 5, 5, 5, 5, 5, 5],
  32.         [ 4, 6, 6, 6, 6, 6, 4, 6, 6, 4, 6, 6, 4, 6, 4, 6, 5, 5, 5, 5, 5, 5, 5],
  33.         [ 4, 4, 4, 4, 4, 4, 4, 7, 6, 4, 4, 4, 4, 6, 4, 6, 5, 5, 5, 5, 5, 5, 5],
  34.         [ 4, 6, 6, 6, 6, 6, 6, 6, 6, 4, 6, 6, 6, 6, 4, 6, 5, 5, 5, 5, 5, 5, 5],]                #size of a maze (0= start, 1=wood, 2= christmas factory, 3= Winterwonderland, 4= Christmasbakery 5=Island)
  35.        
  36. dwarfsays = [   "I heard the bad santa is not the best fellow",         # possible answers that the dwarf says
  37.                 "You really need to find Santa before christmas !!!",
  38.                 "Plaese save our christmas",
  39.                 "Welcome, traveller! ",
  40.                 "Happy Christmas",
  41.                 "It is always usefull to have some christmas pouder:)",
  42.                 "Angles are really nice creatures and sometimes very usefull aswell"]
  43. die = [1,0]                                                             #random array for 8
  44. Class vars:
  45.     life = 100  # Life variable
  46.     elf = 0     # Elf variable
  47.     zutaten = 0 # Zutaten variable
  48. x = 0
  49. y = 0
  50. w = 0
  51. h = 0
  52. win = 0
  53. life = 100 # Life variable
  54. elf = 0     #Elf variable
  55. zutaten = 0 # Zutaten variable
  56.  
  57. def start(x,y):                                                         # function finds out where your start point is
  58.     y = 0
  59.     for h in maze:
  60.         x = 0
  61.         for w in h:
  62.             if(w == 0):
  63.                 break
  64.             x += 1
  65.         if(w == 0):
  66.             break
  67.         y += 1
  68.     return x,y
  69.  
  70.  
  71.  
  72. def move(direction, x, y, maze, win,):                                  # move controlls
  73.  
  74.    
  75.     mazeSizeX = len(maze[0])                                            # checks the size of the maze
  76.     mazeSizeY = len(maze)
  77.     if (direction != "u" and direction != "d" and direction != "l" and direction != "r" and direction !="I am lost" and direction != "Coordinates"):  #checks if you typed in the right words for directions
  78.         print "Invalid direction. Learn to type, Dummkopf!"
  79.     elif (direction == "u"):                                            #control for going up
  80.         if(y-1 == -1 or maze[y-1][x] == 6):                             # preserves you from going trhough a wall or out of the maze
  81.             print "Do you like to run into a wall?"
  82.         else:
  83.             y -=1                                                       #changes your coordinates
  84.     elif (direction == "d"):                                            #control for going down
  85.         if(y+1 == mazeSizeY or maze[y+1][x] == 6):
  86.             print "You hit a wall"
  87.         else:
  88.             y +=1
  89.     elif (direction == "l"):                                            #control for going left
  90.         if(x-1 == -1 or maze[y][x-1] == 6):
  91.             print "WAAAALLLL"
  92.         else:
  93.             x -=1
  94.     elif (direction == "r"):                                        #control for going right
  95.         if(x+1 == mazeSizeX or maze[y][x+1] == 6):
  96.             print "Wall infront of you..."
  97.         else:
  98.             x +=1
  99.     elif (direction == "I am lost"):
  100.         (x,y) = start(x,y)
  101.         print "You are at the beginning again"
  102.     elif (direction == "Coordinates"):
  103.         print (x,y)
  104.    
  105.                                                                            
  106.                                                                        
  107.                                                                        
  108.                                                                        
  109.                                                                        
  110.                                                                         #what happens when...
  111.     if (maze[y][x] == 0):                                               # prints you are at start again when you excidentally come back to the start
  112.         print "You are at the start again"                              # diffrent areas
  113.     if (maze[y][x] == 1):
  114.         print "You are in a wood"
  115.     if (maze[y][x] == 2):
  116.         print "You are in a Christmas Factory"
  117.     if (maze[y][x] == 3):
  118.         print "You are in a Winter Wonderland"
  119.     if (maze[y][x] == 4):
  120.         print "You are in a Christmas bakery"
  121.     if (maze[y][x] == 5):
  122.         print "You are at the island where you can find santa:)"
  123.    
  124.     if (maze[y][x] == 6):
  125.         print "You can't go this way maybe a tree,wall or iglu is infront of you \nyou need to find an other way.. "
  126.    
  127.    
  128.     if(maze[y][x] == 7):                                                #Meeting a Dwarf
  129.         print "You meet a christmas dwarf which says:"
  130.         print dwarfsays[random.randint(0, len(dwarfsays)-1)]            # gets a radom answer from array in line 32 to 36 dwarfsays
  131.    
  132.     # life changing options
  133.        
  134.     if(maze[y][x] == 8):                                        #christmas pouder
  135.         print "You found christmas pouder :)"
  136.         print" That's kind of awesome cause you get 20 % more life"
  137.         vars.life += 20
  138.         print "Your life level is now:",vars.life, "%"
  139.        
  140.     if(maze[y][x] == 9):                                        #Grizzly
  141.         print "Wuah there is a GRIZZLY"
  142.         print"He scratches you and you loose 20 % of your life :("
  143.         vars.life -= 20
  144.         print "Your life level is now:",vars.life, "%"
  145.         if(life <= 0 ):
  146.             print "You are dead"
  147.             (x,y) = start(x,y)
  148.            
  149.  
  150.     if(maze[y][x] == 11):                                       #Machine
  151.         print "Oh no you run into a machine :o"
  152.         print"Your arm got stack in the maschine that must hurt >.< "
  153.         print"You loose 30 % of your life..."
  154.         vars.life -= 30
  155.         print "Your life level is now:",vars.life, "%"
  156.         if(life <= 0 ):
  157.             print "You are dead"
  158.             (x,y) = start(x,y)
  159.  
  160.  
  161.    #Santa deaths
  162.                                         #you meet the bad santa which kills you
  163.     if(maze[y][x] == 12):
  164.         print "You meet the bad santa..."
  165.         print "He was the original santa from finnland who didn't liked christmas at all.."
  166.         print "He wants to kid nap children to cook and eat them .. "
  167.         print "So bad santa is still bad and not amused that you disturbt him while cooking some sauce for the children.."
  168.         print "He troughs his big cooking spoon in your direction.."
  169.         print "It hits your had and now you are dead .. You should probablly not visit the bad santa again"
  170.         print "You are back at the start"
  171.         (x,y) = start(x,y)                                              #sends you back to the beginning
  172.        
  173.     if(maze[y][x] == 13):                                               #what happens when you get on 8 (you eather die of not)
  174.         print "You meet one of bad santas elf, a nacked old man.."
  175.         death = die[random.randint(0, len(die)-1)]
  176.         if death == 0:
  177.             print "You give him a gingerbread and he let's you pass but be carefull..."
  178.         elif death == 1:
  179.             print "He hits you with a piece of wood and you are back to the beginning"
  180.             (x,y) = start(x,y)                                         
  181.        
  182.     # Elfen
  183.     #PROBLEM
  184.     if(maze[y][x] == 14):
  185.         if(vars.elf == 0):
  186.             print "You found the wood elf :)"
  187.             print 'Elf: "Hello :) I am the wood elf, one of Santas 4 best friends. '
  188.             print 'You will need all our help to confince him that christmas needs him..'
  189.             print 'So lets find the other 3 :) We should go to the Winter Wonderland now.."'
  190.             vars.elf += 1
  191.             print vars.elf
  192.         else:
  193.             print "you already found the wood elf"
  194.     if(maze[y][x] == 15):
  195.         if(vars.elf == 1):
  196.             print "Hey that's Rudolf :)"
  197.             print'Rudolf: "Hello christmas good soul.. I heard you want to save christmas?!'
  198.             print 'So i will help you.. Next we should go to the christmas factory.."'
  199.             elf += 1
  200.         elif(vars.elf != 0):
  201.             print "you already found the wood elf"
  202.         print vars.elf
  203.     if(maze[y][x] == 16):
  204.         if(vars.elf == 2):
  205.             if(vars.zutaten == 4):
  206.                 print "Finally you found another fellow of Santa the christmas imp"
  207.                 print 'Imp: "Good that you found me.. Fast lets go to the Bakery"'
  208.                 vars.elf += 1
  209.             else:
  210.                 print "You need to find some more things"
  211.         else:
  212.             print "you already found the wood elf"
  213.         print elf
  214.     if(maze[y][x] == 17):
  215.         if(vars.elf == 3):
  216.             print "Congratulations you found Santas wife the last of santas followers"
  217.             print 'Ms Santa: "Argh good lord you want to confince this old stubbon man'
  218.             print 'Okay I will help you.. but just because you seem to be a nice person. Lets find the airport!"'
  219.             vars.elf += 1
  220.         else:
  221.             print "you already found the wood elf"
  222.         print vars.elf
  223.        
  224.     # Angles
  225.    
  226.     if(maze[y][x] == 18):         # angle 1
  227.         print"Hi I am a christmas angle and me and my friends will give you some advices on your way:)"
  228.         print "Now you are in the forest at the beginning of your journey"
  229.         print"On your way you will need to find some things or people to confince santa that christmas as wonderful"
  230.         print"In the forest you need to find the wood elf but be pationed there are some creature who don't want your best "
  231.         print"GOOD LUCK!"
  232.        
  233.     if(maze[y][x] == 19):         # angle 2
  234.         print"Hello I hear someone tries to save christmas are you this person?"
  235.         print"That is really nice of you :) So i will help you a little bit!"
  236.         print"You are in the winter winderland now the second of four parts.."
  237.         print"You need to find Rudolf in these parts"
  238.         print"Safe travel!"
  239.        
  240.     if(maze[y][x] == 20):         # angle 3
  241.         print"Tralalalalala.. Oh hola !"
  242.         print"You are now in the christmas factory"
  243.         print"Could you please do me a favour and bring my good friend the imp some christmas things, four exacly!?"
  244.         print"Than he will help you to find santa"
  245.         print"Thank you and watch out for the machines!"
  246.    
  247.     if(maze[y][x] == 21):         # angle 4
  248.         print"HOHOHO You are now in the last part of you journey "
  249.         print"This is the christmas Bakery"
  250.         print"You want find any dangerous things here but you will need to solve some riddle"
  251.         print"Are you ready?"
  252.         print"Great:))"
  253.    
  254.     #Snowballfight
  255.    
  256.     if(maze[y][x] == 10):                                       #Snowball hits you
  257.         print "Uh a Snowball hit you"
  258.         print"You loose 10 % of your life watch out for them..."
  259.         vars.life -= 10
  260.         print "Your life level is now:",vars.life, "%"
  261.         if(life <= 0 ):
  262.             print "You are dead"
  263.             (x,y) = start(x,y)
  264.  
  265.     if(maze[y][x] == 22):                                              
  266.         print "You run into a snowball fight be carefull that no snowball hits you"
  267.            
  268.     if(maze[y][x] == 23):                                              
  269.         print "Snowballs everywhere but you didn't get one ;)"
  270.  
  271.     #Ice
  272.    
  273.     if(maze[y][x] == 24):
  274.         print "You are walking on a frozen river. Watch out for holes in the ice"
  275.        
  276.     if(maze[y][x] == 25):
  277.         print"You fell into a hole in the ice you are dead:("
  278.         (x,y) = start(x,y)
  279.        
  280.    
  281.     if(maze[y][x] == 26):
  282.             print"You found one of the things you need for the imp"
  283.             vars.zutaten += 1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement