<s> from sys import exit <EOL> from random import randint <EOL> class Scene ( object ) : <EOL> def enter ( self ) : <EOL> print "<STR_LIT>" <EOL> exit ( <NUM_LIT:1> ) <EOL> class Engine ( object ) : <EOL> def __init__ ( self , scene_map ) : <EOL> self . scene_map = scene_map <EOL> def play ( self ) : <EOL> current_scene = self . scene_map . opening_scene ( ) <EOL> last_scene = self . scene_map . next_scene ( '<STR_LIT>' ) <EOL> while current_scene != last_scene : <EOL> next_scene_name = current_scene . enter ( ) <EOL> current_scene = self . scene_map . next_scene ( next_scene_name ) <EOL> current_scene . enter ( ) <EOL> class Death ( Scene ) : <EOL> quips = [ <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" <EOL> ] <EOL> def enter ( self ) : <EOL> print Death . quips [ randint ( <NUM_LIT:0> , len ( self . quips ) - <NUM_LIT:1> ) ] <EOL> exit ( <NUM_LIT:1> ) <EOL> class CentralCorridor ( Scene ) : <EOL> def enter ( self ) : <EOL> print "<STR_LIT>" <EOL> print "<STR_LIT>" <EOL> print "<STR_LIT>" <EOL> print "<STR_LIT>" <EOL> print "<STR_LIT>" <EOL> print "<STR_LIT:\n>" <EOL> print "<STR_LIT>" <EOL> print "<STR_LIT>" <EOL> print "<STR_LIT>" <EOL> print "<STR_LIT>" <EOL> action = raw_input ( "<STR_LIT>" ) <EOL> if action == "<STR_LIT>" : <EOL> print "<STR_LIT>" <EOL> print "<STR_LIT>" <EOL> print "<STR_LIT>" <EOL> print "<STR_LIT>" <EOL> print "<STR_LIT>" <EOL> print "<STR_LIT>" <EOL> return '<STR_LIT>' <EOL> elif action == "<STR_LIT>" : <EOL> print "<STR_LIT>" <EOL> print "<STR_LIT>" <EOL> print "<STR_LIT>" <EOL> print "<STR_LIT>" <EOL> print "<STR_LIT>" <EOL> print "<STR_LIT>" <EOL> return '<STR_LIT>' <EOL> elif action == "<STR_LIT>" : <EOL> print "<STR_LIT>" <EOL> print "<STR_LIT>" <EOL> print "<STR_LIT>" <EOL> print "<STR_LIT>" <EOL> print "<STR_LIT>" <EOL> print "<STR_LIT>" <EOL> return '<STR_LIT>' <EOL> else : <EOL> print "<STR_LIT>" <EOL> return '<STR_LIT>' <EOL> class LaserWeaponArmory ( Scene ) : <EOL> def enter ( self ) : <EOL> print "<STR_LIT>" <EOL> print "<STR_LIT>" <EOL> print "<STR_LIT>" <EOL> print "<STR_LIT>" <EOL> print "<STR_LIT>" <EOL> print "<STR_LIT>" <EOL> print "<STR_LIT>" <EOL> code = "<STR_LIT>" % ( randint ( <NUM_LIT:1> , <NUM_LIT:9> ) , randint ( <NUM_LIT:1> , <NUM_LIT:9> ) , randint ( <NUM_LIT:1> , <NUM_LIT:9> ) ) <EOL> guess = raw_input ( "<STR_LIT>" ) <EOL> guesses = <NUM_LIT:0> <EOL> while guess != code and guesses < <NUM_LIT:10> : <EOL> print "<STR_LIT>" <EOL> guesses += <NUM_LIT:1> <EOL> guess = raw_input ( "<STR_LIT>" ) <EOL> if guess == code : <EOL> print "<STR_LIT>" <EOL> print "<STR_LIT>" <EOL> print "<STR_LIT>" <EOL> return '<STR_LIT>' <EOL> else : <EOL> print "<STR_LIT>" <EOL> print "<STR_LIT>" <EOL> print "<STR_LIT>" <EOL> print "<STR_LIT>" <EOL> return '<STR_LIT>' <EOL> class TheBridge ( Scene ) : <EOL> def enter ( self ) : <EOL> print "<STR_LIT>" <EOL> print "<STR_LIT>" <EOL> print "<STR_LIT>" <EOL> print "<STR_LIT>" <EOL> print "<STR_LIT>" <EOL> print "<STR_LIT>" <EOL> action = raw_input ( "<STR_LIT>" ) <EOL> if action == "<STR_LIT>" : <EOL> print "<STR_LIT>" <EOL> print "<STR_LIT>" <EOL> print "<STR_LIT>" <EOL> print "<STR_LIT>" <EOL> print "<STR_LIT>" <EOL> print "<STR_LIT>" <EOL> return '<STR_LIT>' <EOL> elif action == "<STR_LIT>" : <EOL> print "<STR_LIT>" <EOL> print "<STR_LIT>" <EOL> print "<STR_LIT>" <EOL> print "<STR_LIT>" <EOL> print "<STR_LIT>" <EOL> print "<STR_LIT>" <EOL> print "<STR_LIT>" <EOL> print "<STR_LIT>" <EOL> return '<STR_LIT>' <EOL> else : <EOL> print "<STR_LIT>" <EOL> return "<STR_LIT>" <EOL> class EscapePod ( Scene ) : <EOL> def enter ( self ) : <EOL> print "<STR_LIT>" <EOL> print "<STR_LIT>" <EOL> print "<STR_LIT>" <EOL> print "<STR_LIT>" <EOL> print "<STR_LIT>" <EOL> print "<STR_LIT>" <EOL> print "<STR_LIT>" <EOL> good_pod = randint ( <NUM_LIT:1> , <NUM_LIT:5> ) <EOL> guess = raw_input ( "<STR_LIT>" ) <EOL> if int ( guess ) != good_pod : <EOL> print "<STR_LIT>" % guess <EOL> print "<STR_LIT>" <EOL> print "<STR_LIT>" <EOL> print "<STR_LIT>" <EOL> return '<STR_LIT>' <EOL> else : <EOL> print "<STR_LIT>" % guess <EOL> print "<STR_LIT>" <EOL> print "<STR_LIT>" <EOL> print "<STR_LIT>" <EOL> print "<STR_LIT>" <EOL> print "<STR_LIT>" <EOL> return '<STR_LIT>' <EOL> class Finished ( Scene ) : <EOL> def enter ( self ) : <EOL> print "<STR_LIT>" <EOL> return '<STR_LIT>' <EOL> class Map ( object ) : <EOL> scenes = { <EOL> '<STR_LIT>' : CentralCorridor ( ) , <EOL> '<STR_LIT>' : LaserWeaponArmory ( ) , <EOL> '<STR_LIT>' : TheBridge ( ) , <EOL> '<STR_LIT>' : EscapePod ( ) , <EOL> '<STR_LIT>' : Death ( ) , <EOL> '<STR_LIT>' : Finished ( ) , <EOL> } <EOL> def __init__ ( self , start_scene ) : <EOL> self . start_scene = start_scene <EOL> def next_scene ( self , scene_name ) : <EOL> val = Map . scenes . get ( scene_name ) <EOL> return val <EOL> def opening_scene ( self ) : <EOL> return self . next_scene ( self . start_scene ) <EOL> a_map = Map ( '<STR_LIT>' ) <EOL> a_game = Engine ( a_map ) <EOL> a_game . play ( ) </s>
