document.write('
Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. import curses
  2. from curses import *
  3. import random
  4.  
  5. # -----------------------------------------------------------------------------
  6. class curses_screen:
  7.     """ Creates A Screen """
  8.     def __enter__(self):
  9.         self.stdscr = curses.initscr()
  10.         curses.cbreak()
  11.         self.stdscr.clear()
  12.         curses.noecho()
  13.         self.stdscr.keypad(1)
  14.         self.stdscr.border(0)
  15.         return self.stdscr
  16.     def __exit__(self,a,b,c):
  17.         curses.echo()
  18.         curses.endwin()
  19.         self.stdscr.getch()
  20.         self.stdscr.clear()
  21.         self.stdscr.refresh()
  22. # -----------------------------------------------------------------------------
  23. class curses_window:
  24.     """ Creates A Window """
  25.     def __init__(self):
  26.         curses.curs_set(0)
  27.         curses.noecho()
  28.         self.win=curses.newwin(LINES-4,COLS-4,2,2)
  29.         self.win.clear()
  30.         self.win.refresh()
  31.         self.win.keypad(1)
  32. #------------------------------------------------------------------------------
  33. class Gun:
  34.     """ Generates Firing Machines """
  35.     def __init__(self,Arena,Y,X,Pos,LINES,COLS,Level):
  36.         """ Initializing Gun """
  37.         if LEVEL==2:
  38.             self.Y=Y
  39.             self.X=X+3 if Pos==0 else X-1
  40.             map(lambda x: map(lambda y: Arena.addch(Y+y,X+x,\'#\'),range(3)),range(3))
  41.             if Pos==0:
  42.                 Arena.addch(Y,X+2,\' \')
  43.                 Arena.addch(Y+2,X+2,\' \')
  44.             if Pos==1:
  45.                 Arena.addch(Y,X,\' \')
  46.                 Arena.addch(Y+2,X,\' \')
  47.         if LEVEL==3:
  48.             if Pos ==0: map(lambda x: Arena.addstr(1,x,"### "),range(3,COLS-7,4))
  49.             else:  map(lambda x: Arena.addstr(LINES-1,x,"### "),range(3,COLS-7,4))
  50.             self.yx=range(4,COLS-3,4)
  51.     def fire_small(self,Pos):
  52.         """ Calculate Position Of Small Bullet """
  53.         if Pos==0:
  54.             return (self.X+2) if self.X<COLS-2 else 4
  55.         else:
  56.             return (self.X-2) if self.X>1 else COLS-5
  57.  
  58.     def getBullPos(self,Arena,Pos):
  59.         """ Firing Small Bullet """
  60.         if Arena.inch(self.Y+1,self.X)&255!=ord(\'D\'):
  61.             Arena.addch(self.Y+1,self.X,\' \')
  62.         self.X=self.fire_small(Pos)
  63.         if Pos==0:
  64.             if Arena.inch(self.Y+1,self.X)&255!=ord(\'D\'):
  65.                 Arena.addch(self.Y+1,self.X,\'>\')
  66.         elif Pos==1:
  67.             if Arena.inch(self.Y+1,self.X)&255!=ord(\'D\'):
  68.                 Arena.addch(self.Y+1,self.X,\'<\')
  69.         return self.Y+1,self.X
  70.    
  71.     def fire_big(self,Arena,flag,x_loc,y_loc,Pos):
  72.         """ Calculate Position Of Big Bullet """
  73.         if flag==0:
  74.             x_loc=random.choice(self.yx)
  75.         if Pos==0:
  76.             if Arena.inch(y_loc,x_loc)&255!=ord(\'D\'):
  77.                 Arena.addstr(y_loc,x_loc,\'/\')
  78.             if Arena.inch(y_loc+1,x_loc)&255!=ord(\'D\'):
  79.                 Arena.addstr(y_loc+1,x_loc,\'\\\\\')
  80.             return y_loc+2,x_loc
  81.         else:
  82.             if Arena.inch(y_loc,x_loc)&255!=ord(\'D\'):
  83.                 Arena.addstr(y_loc,x_loc,\'/\')
  84.             if Arena.inch(y_loc-1,x_loc)&255!=ord(\'D\'):
  85.                 Arena.addstr(y_loc-1,x_loc,\'\\\\\')
  86.             return y_loc-2,x_loc
  87.                
  88.     def clear(self,Arena,x_loc,Pos):
  89.         """ Clearing Game Window """
  90.         L=range(2,LINES-1)
  91.         if Pos==0:
  92.             for i in L:
  93.                 if Arena.inch(i,x_loc)&255!=ord(\'D\'):
  94.                     Arena.addstr(i,x_loc,\' \')
  95.         else:
  96.             L.reverse()
  97.             for i in L:
  98.                 if Arena.inch(i,x_loc)&255!=ord(\'D\'):
  99.                     Arena.addstr(i,x_loc,\' \')
  100. #+-----------------------------------------------------------------------------
  101. def Print_File(self,file,y,x,LINES,COLS):
  102.     """ Printing ASCII Art """
  103.     F=open(file)
  104.     F=F.readlines()
  105.     for lines in F:
  106.         self.addstr(y,x,lines);
  107.         y+=1
  108.         if y==LINES-1: break
  109.     return y
  110. def Pause2(self,time):
  111.     """ Simple Pause """
  112.     for i in range(25):
  113.         self.timeout(time)
  114.         getKey=self.getch()
  115.  
  116. class MyGame(curses_window):
  117.     """ Main Game Class """
  118.     def Pause(self):
  119.         """ Pause = Press P or p """
  120.         while True:
  121.             if self.win.getch() in [80,112]:
  122.                 break
  123.    
  124.     def Display_Hash(self,LINES,COLS,x_loc,y_loc):
  125.         """ Display Animated Hash """
  126.         a,b,x,y,flag,ctr=LINES-2,1,1,COLS-2,0,3
  127.         while True:
  128.             self.win.timeout(ctr)
  129.             getKey=self.win.getch()
  130.             if len([(l,m) for l in range(y_loc-4,y_loc+4*2) for m in range(x_loc-5,x_loc+5*2) if (l,m) ==(a,b)])==0:
  131.                 self.win.addch(a,b,\'#\')
  132.             if len([(l,m) for l in range(y_loc-4,y_loc+4*2) for m in range(x_loc-5,x_loc+5*2) if (l,m) ==(x,y)])==0:
  133.                 self.win.addch(x,y,\'#\')
  134.             if flag==0:
  135.                 if b==(COLS-2):
  136.                     a,flag,x=a-1,1,x+1
  137.                 else:
  138.                     b,y=b+1,y-1
  139.             else:
  140.                 if b==1:
  141.                     a,x,flag=a-1,x+1,0
  142.                 else:
  143.                     b,y=b-1,y+1
  144.             if (abs(b-y)==1 or b==y) and a==x:
  145.                 ctr=1
  146.             if a==0:
  147.                 break
  148.     def Display_Crash(self,Game,x_loc,y_loc):
  149.         """ Display Flashing Effect """
  150.         j,flag=3,0
  151.         for i in range(5):
  152.             Game.getch()
  153.             curses.flash() 
  154.         Game.clear()
  155.        
  156.     def Start(self,Game,LINES,COLS,LEVEL):
  157.         """ Initialize The Game @ Given Level -- Heart Of Program"""
  158.         Game.clear()
  159.         Game.border(\'|\',\'|\',\'-\',\'-\',\'+\',\'+\',\'+\',\'+\')
  160.         x_loc=random.randint(8,COLS-10) # Generating Random Coordinates
  161.         y_loc=random.randint(8,LINES-10)
  162.         ROBO.Place(y_loc,x_loc,Game) #Placing The Robot
  163.         DIFFUSE_C,N_Codes,DC_xy,Key,B_xy=0,10,{},KEY_LEFT,{} #Specifying Constants Which Can Be Altered By The Programmer
  164.         flag=0
  165.         bull_y,bull_x=LINES/5+1,2
  166.         l,m=(random.randint(4,LINES-5),random.randint(4,COLS-6))
  167.         for x in range(3):
  168.             for y in range(3):
  169.                 B_xy[(l+x,m+y)]=1
  170.         for x in range(N_Codes): DC_xy[(random.randint(1,LINES-5),random.randint(4,COLS-6))]=x
  171.         map(lambda x: Game.addch(x[0],x[1],\'D\'),DC_xy) #Placing Diffuce Codes & Bomb
  172.         map(lambda x: Game.addch(x[0],x[1],\'0\'),B_xy)
  173.         global Score
  174.         if LEVEL==1:
  175.                 Score=0
  176.                 Limit=401
  177.         if LEVEL==2:
  178.                 Gun1=Gun(Game,LINES/5,1,0,LINES,COLS,LEVEL) #Creating Gun Objects
  179.                 Gun2=Gun(Game,3*LINES/5,1,0,LINES,COLS,LEVEL)
  180.                 Gun3=Gun(Game,2*LINES/5,COLS-4,1,LINES,COLS,LEVEL)
  181.                 Gun4=Gun(Game,4*LINES/5,COLS-4,1,LINES,COLS,LEVEL)
  182.                 Limit=601
  183.         if LEVEL==3:
  184.                 MultiGun1=Gun(Game,1,COLS,0,LINES,COLS,LEVEL)#Creating Lightening Objects
  185.                 MultiGun2=Gun(Game,1,COLS,1,LINES,COLS,LEVEL)
  186.                 La=map(lambda x: (1,x),range(COLS))
  187.                 mxa_loc,mya_loc=4,2
  188.                 Lb=map(lambda x: (LINES-1,x),range(COLS))
  189.                 mxb_loc,myb_loc=LINES-2,COLS-2
  190.                 flag2=0
  191.                 Limit=801
  192.         time=0
  193.         REASON=""
  194.         while True:
  195.             if Key==27:
  196.                 self.End(self.win,Score,LEVEL,LINES,COLS)
  197.                 return -1,REASON
  198.             if time==Limit:
  199.                    map(lambda x: map(lambda y:Game.addch(l+x,m+y,\'0\'), range(3)),range(3))
  200.                    Game.addch(l+3/2,m+3/2,\'0\')
  201.                    for i in range(3):
  202.                        Game.addstr(l-2,m-2,"BEEP!")
  203.                        Pause2(self.win,25)       
  204.                        Game.addstr(l-2,m-2,"     ")
  205.                        Pause2(self.win,25)       
  206.                        Pause2(self.win,3)        
  207.                    Game.addstr(l-2,m,"KABOOM!")
  208.                    self.Display_Hash(LINES,COLS,m,l)
  209.                    REASON="*****TIME FINISHED & BOMB EXPLODED*****"
  210.             time+=1
  211.             if flag==0:
  212.                    map(lambda x: map(lambda y:Game.addch(l+x,m+y,\' \'), range(3)),range(3))
  213.                    Game.addch(l+3/2,m+3/2,\'0\')
  214.                    flag=1
  215.             else:
  216.                    map(lambda x: map(lambda y:Game.addch(l+x,m+y,\'0\'), range(3)),range(3))
  217.                    Game.addch(l+3/2,m+3/2,\' \')
  218.                    flag=0
  219.             Game.addstr(0,36," ")
  220.             Game.addstr(0,5,"NUMBER OF DIFFUSE CODES LEFT: "+str(N_Codes-DIFFUSE_C))
  221.             Game.addstr(0,COLS-4,"   ")
  222.             Game.addstr(0,COLS-16,"TIME LEFT: "+str(Limit-time))
  223.             Game.addstr(0,COLS/2+7,"   ")
  224.             Game.addstr(0,COLS/2,"SCORE: "+str(Score))
  225.             Game.timeout(180)
  226.             getKey=Game.getch()
  227.             if getKey in [80,112]:
  228.                 Game.addstr(LINES-2,2,"GAME PAUSED")
  229.                     self.Pause()
  230.                 Game.addstr(LINES-2,2,"           ")
  231.             Key=Key if getKey not in [258,259,260,261,27] else getKey
  232.             x_loc,y_loc=ROBO.Move(y_loc,x_loc,Game,Key)
  233.             if LEVEL==2:
  234.                 L=[]
  235.                 L.append(Gun1.getBullPos(Game,0))
  236.                 L.append(Gun2.getBullPos(Game,0))
  237.                 L.append(Gun3.getBullPos(Game,1))
  238.                 L.append(Gun4.getBullPos(Game,1))
  239.             if LEVEL==3:
  240.                 if flag2==0:
  241.                     L=[(mya_loc,mxa_loc),(myb_loc,mxb_loc)]
  242.                     mya_loc,mxa_loc=MultiGun1.fire_big(Game,flag2,mxa_loc,2,0)
  243.                     myb_loc,mxb_loc=MultiGun2.fire_big(Game,flag2,mxb_loc,LINES-2,1)
  244.                     flag2=1
  245.                 else:
  246.                     mya_loc,mxa_loc=MultiGun1.fire_big(Game,flag2,mxa_loc,mya_loc,0)
  247.                     myb_loc,mxb_loc=MultiGun2.fire_big(Game,flag2,mxb_loc,myb_loc,1)
  248.                     L[len(L):]=[(mya_loc,mxa_loc),(myb_loc,mxb_loc)]
  249.                         if abs(mya_loc-LINES)<3:
  250.                         flag2=0
  251.                         MultiGun1.clear(Game,mxa_loc,0)
  252.                         MultiGun2.clear(Game,mxb_loc,1)
  253.             for x in range(x_loc,x_loc+5):
  254.                 for y in range(y_loc,y_loc+4):
  255.                     if (y,x) in B_xy:
  256.                         if DIFFUSE_C<N_Codes:
  257.                             self.Display_Hash(LINES,COLS,x_loc,y_loc)
  258.                             REASON="****YOU DIDN\'T HAVE ENOUGH DIFFUSE CODES!****"
  259.                             return 0,REASON
  260.                         else:
  261.                             return 1,REASON
  262.                     if (y,x) in DC_xy:
  263.                         DIFFUSE_C+=1
  264.                         Score+=DIFFUSE_C*(Limit-time)
  265.                         DC_xy.pop((y,x))
  266.                     if LEVEL==2:
  267.                         if (y,x) in L:
  268.                             curses.flash()
  269.                             self.Display_Hash(LINES,COLS,x_loc,y_loc)
  270.                             REASON="****YOUR ROBOT GOT SCREWED!****"
  271.                             return 0,REASON
  272.                     if LEVEL==3:
  273.                         if (y,x) in L or (y,x) in La+Lb:
  274.                             curses.flash()
  275.                             REASON="****YOUR ROBOT WAS STRUCK BY LIGHTENING!****"
  276.                             self.Display_Hash(LINES,COLS,x_loc,y_loc)
  277.                             return 0,REASON
  278.             if x_loc in [0,COLS-5] or y_loc in [0,LINES-4]:
  279.                 self.Display_Crash(Game,x_loc,y_loc)
  280.                 REASON="****YOUR ROBOT WENT OUT OF BOUNDS!****"
  281.                 return 0,REASON
  282.     def End(Arena,self,Score,LEVEL,LINES,COLS):
  283.         """ Ending The Game """
  284.         self.clear()
  285.         F=open("GameOver.txt")
  286.         F=F.readlines()
  287.         y,x=2,2
  288.         for lines in F:
  289.             self.addstr(y,x,lines)
  290.             y+=1
  291.         self.border(\'|\',\'|\',\'-\',\'-\',\'+\',\'+\',\'+\',\'+\')
  292.         self.addstr(LINES/2,COLS/2,"Your Score :"+str(Score))
  293.         self.addstr(LINES/2+1,COLS/2,"You Completed "+str(LEVEL-1)+" Level(s)!")
  294.         Key=self.getch()
  295.         while True:
  296.             self.addstr(LINES/2+2,COLS/2,"Press Escape To Exit...")
  297.             if Key==27: break
  298.             Key=self.getch()
  299.        
  300.    
  301.    
  302.     def Loading(self,LINES,COLS):
  303.         """ Loading A Particular Level """
  304.         self.win.addch(LINES-2,2,\'[\')
  305.         self.win.addch(LINES-2,COLS-2,\']\')
  306.         x=3
  307.         while x!=COLS-2:
  308.             self.win.addch(LINES-2,x,\'#\')
  309.             x+=1
  310.             Pause2(self.win,1)
  311.    
  312.     def Display_Choice(Arena,self,REASON,LINES,COLS):
  313.         """ Display Choices When Robot Dies """
  314.         self.clear()
  315.         self.border(\'|\',\'|\',\'-\',\'-\',\'+\',\'+\',\'+\',\'+\')
  316.         self.addstr(LINES/2-10,COLS/2-10,REASON)
  317.         self.addstr(LINES/2-9,COLS/2-10,"Choices Available: ")
  318.         self.addstr(LINES/2-8,COLS/2-10,"1: Restart Level")
  319.         self.addstr(LINES/2-7,COLS/2-10,"2: Exit Game")
  320.         Key=self.getch()
  321.         while True:
  322.             if Key in [49,50]:
  323.                 return Key-48
  324.             elif Key!=-1:
  325.                 self.addstr(LINES/2-5,COLS/2-10,"Press 1 or 2 Only!")
  326.             Key=self.getch()
  327.        
  328. # -----------------------------------------------------------------------------
  329. #ROBOT_STYLES:
  330.            
  331. R=[[[\' \',\'i\',\' \',\'i\',\' \'],[\'[\',\'*\',\'_\',\'*\',\']\'],[\'/\',\'|\',\'_\',\'|\',\'\\\\\'],[\' \',\'/\',\' \',\'\\\\\',\' \']],
  332. [[\' \',\'!\',\' \',\'!\',\' \'],[\'[\',\'+\',\'_\',\'+\',\']\'],[\'!\',\'.\',\'_\',\'.\',\'!\'],[\'_\',\'|\',\' \',\'|\',\'_\']],
  333. [[\' \',\'|\',\'_\',\'|\',\' \'],[\'d\',\'O\',\'_\',\'O\',\'b\'],[\' \',\'[\',\'_\',\']\',\' \'],[\' \',\'^\',\' \',\'^\',\' \']],
  334. [[\' \',\'\\\\\',\' \',\'/\',\' \'],[\'[\',\'@\',\'_\',\'@\',\']\'],[\'/\',\'|\',\'_\',\'|\',\'\\\\\'],[\' \',\'d\',\' \',\'b\',\' \']],
  335. [[\'\\\\\',\'^\',\' \',\'^\',\'/\'],[\'[\',\'o\',\' \',\'o\',\']\'],[\'$\',\'[\',\'_\',\']\',\'$\'],[\'_\',\'|\',\' \',\'|\',\'_\']],
  336. [[\'\\\\\',\'_\',\'*\',\'_\',\'/\'],[\'|\',\'^\',\'_\',\'^\',\'|\'],[\'<\',\'|\',\' \',\'|\',\'>\'],[\' \',\'0\',\' \',\'0\',\' \']],
  337. [[\' \',\'M\',\' \',\'M\',\' \'],[\'<\',\'@\',\'_\',\'@\',\'>\'],[\'\\\\\',\'\\"\',\'_\',\'\\"\',\'/\'],[\' \',\'%\',\' \',\'%\',\' \']],
  338. [[\' \',\'*\',\'_\',\'*\',\' \'],[\'[\',\'0\',\'_\',\'0\',\']\'],[\'/\',\'(\',\'+\',\')\',\'\\\\\'],[\'_\',\'|\',\' \',\'|\',\'_\']],
  339. [[\' \',\'$\',\'^\',\'$\',\' \'],[\'{\',\'x\',\'_\',\'x\',\'}\'],[\'/\',\')\',\'_\',\'(\',\'\\\\\'],[\' \',\'u\',\' \',\'u\',\' \']],
  340. [[\'_\',\'|\',\'^\',\'|\',\'_\'],[\'[\',\'p\',\'_\',\'p\',\']\'],[\'-\',\'|\',\'_\',\'|\',\'-\'],[\'\\\\\',\'0\',\'_\',\'0\',\'/\']]]
  341. class Robot:
  342.     """ ROBOT Definitions """
  343.     def __init__(self,choice):
  344.         """ Initialize Robot On Selection Criteria """
  345.         self.type=R[choice]
  346.     def Place(self,y_loc,x_loc,scr):
  347.         """ Place Robot @ Given Coordinates """
  348.         map(lambda i: map(lambda j: scr.addch(i,j,self.type[i-y_loc][j-x_loc]),range(x_loc,x_loc+5)),range(y_loc,y_loc+4))
  349.     def Move(self,y_loc,x_loc,scr,Key):
  350.         """ Move Robot @ Given Coordinates """
  351.         x_a,y_a=(Key==KEY_LEFT and -1 or Key==KEY_RIGHT and 1),(Key==KEY_UP and -1 or Key==KEY_DOWN and 1)
  352.         x_r,y_r=(Key==KEY_LEFT and 5 or Key==KEY_RIGHT and -1),(Key==KEY_UP and 4 or Key==KEY_DOWN and -1)
  353.         start=(((Key==KEY_LEFT or Key==KEY_RIGHT) and y_loc+y_a) or ((Key==KEY_UP or Key==KEY_DOWN) and x_loc+x_a))
  354.         end=(((Key==KEY_LEFT or Key==KEY_RIGHT) and y_loc+y_a+4) or ((Key==KEY_UP or Key==KEY_DOWN) and x_loc+x_a+5))
  355.         self.Place(y_loc+y_a,x_loc+x_a,scr)
  356.         if Key==KEY_LEFT or Key==KEY_RIGHT:
  357.             map(lambda i: scr.addch(i,x_loc+x_a+x_r,\' \'),range(start,end))
  358.         if Key==KEY_UP or Key==KEY_DOWN:
  359.             map(lambda i: scr.addch(y_loc+y_a+y_r,i,\' \'),range(start,end))
  360.         return x_loc+x_a,y_loc+y_a
  361. # -----------------------------------------------------------------------------
  362. with curses_screen() as welcome:
  363.     """ Welcome Is An Object Of The Class: curses_screen """
  364.     LINES,COLS=welcome.getmaxyx()
  365.     y=Print_File(welcome,"Robot2.txt",2,2,LINES,COLS)
  366.     y=Print_File(welcome,"Robot1.txt",2,COLS/2,LINES,COLS)
  367.     welcome.border(0)
  368.     welcome.addstr(y-3,COLS/2-30,"WELCOME TO ROBO-BOMB-DEFUSER!")
  369.     welcome.addstr(y-2,COLS/2-30,"Press Any Key To Continue...")
  370. # -----------------------------------------------------------------------------
  371. with curses_screen() as Select_Robot:
  372.     """ Select_Robot Is An Object Of The Class: curses_screen """
  373.     LINES,COLS=Select_Robot.getmaxyx()
  374.     Select_Robot.addstr(2,(COLS-18)/2,"SELECT YOUR ROBOT!")
  375.     MyRobo={}
  376.     for i in range(10):
  377.         MyRobo[i]=Robot(i)
  378.         MyRobo[i].Place(LINES/2,(((COLS-50)/11)+5)*(i+1),Select_Robot)
  379.         Select_Robot.addstr(LINES/2+5,(((COLS-50)/11)+5)*(i+1),"Robot "+"%c"%(i+ord(\'A\')))
  380.     Select_Robot.addstr(LINES/2+10,COLS/2-32,"Enter Your Selection: ")
  381.     global ROBO
  382.     Key=Select_Robot.getch()
  383.     SELECTED=False
  384.     while True:
  385.         if Key in range(65,75):
  386.             Select_Robot.addch(LINES/2+10,COLS/2-10,Key)
  387.             ROBO=Robot(Key-ord(\'A\'))
  388.             ROBO.Place(LINES/2+7,COLS/2,Select_Robot)
  389.             SELECTED=True
  390.         else:
  391.             Select_Robot.addstr(LINES-2,COLS/2-30,"Press Keys Between A-J Only!")
  392.         Key=Select_Robot.getch()
  393.         if Key==10 and SELECTED==True: break
  394.     Select_Robot.addstr(LINES-2,COLS/2-30,"Press Any Key To Continue...")
  395. # -----------------------------------------------------------------------------
  396. Game=MyGame() # Creating an object of MyGame Class
  397. Arena=Game.win
  398. Arena.bkgd(curses.A_REVERSE)
  399. LINES,COLS=Arena.getmaxyx()
  400. LEVEL=1
  401. while True:
  402.     Arena.clear()
  403.     Arena.refresh()
  404.     Arena.border(\'|\',\'|\',\'-\',\'-\',\'+\',\'+\',\'+\',\'+\')
  405.     Print_File(Arena,"Loading.txt",LINES/2-10,COLS/2-30,LINES,COLS)
  406.     Print_File(Arena,\'Level\'+str(LEVEL)+\'.txt\',LINES/2-10+8,COLS/2-30,LINES,COLS)
  407.     Arena.border(\'|\',\'|\',\'-\',\'-\',\'+\',\'+\',\'+\',\'+\')
  408.     Game.Loading(LINES,COLS)
  409.     Key=Arena.getch()
  410.     global Score
  411.     while Key==-1:
  412.         Arena.addstr(LINES-10,COLS/2-20,"Press Any Key To Continue...")
  413.         Key=Arena.getch()
  414.     Exit_Status,REASON=Game.Start(Arena,LINES,COLS,LEVEL)
  415.     if Exit_Status==-1: break
  416.     elif Exit_Status==1:
  417.         LEVEL+=1
  418.     else:
  419.         Exit_Status=Game.Display_Choice(Arena,REASON,LINES,COLS)
  420.         if Exit_Status==1: Score=0
  421.     if Exit_Status==2 or LEVEL==4:
  422.         Game.End(Arena,Score,LEVEL,LINES,COLS)
  423.         break
  424. Game.win.clear() # Exiting Quitely!
  425. curses.endwin()
');