def test_room(): paint = Scene("PaintScene", "paintroom", """ This room has a painting. """) assert_equal(paint.title, "PaintScene") assert_equal(paint.urlname, "paintroom") assert_equal(paint.paths, {})
def test_room(): gold = Scene( "GoldScene", "goldroom", """This room has gold in it you can grab.There's a door to the north.""") assert_equal(gold.title, "GoldScene") assert_equal(gold.urlname, "goldroom") assert_equal(gold.paths, {})
def test_room_paths(): center = Scene("Center", "Test room in the center.") north = Scene("North", "Test room in the north.") south = Scene("South", "Test room in the south.") center.add_paths({'north': north, 'south': south}) assert_equal(center.go('north'), north) assert_equal(center.go('south'), south)
from map import Scene # Creating the Scenes of the game prologue = Scene( "Prologue", "prologue", """ Billy keeps having the same nightmare over and over again. In his dream he wakes up in his bed and everything seems to be normal, but it's not. Billy's plush toys are gone. And they want to kill Billy. He is only save in illuminated area, like his bed which is illuminated by his night light. Only in the dark his plush toys will attack Billy. Of course, all light switches disappear in his dream. Whenever he can't defend himself successfully, he would wake up in the same dream. The only way to wake up in the real world is to leave the house through the front door. How Billy's plush animals are approaching him would change from night to night. """, """ Now, what should Billy do? 1. open his eyes 2. stay under the blanket """) bunny = Scene( "Bunny? Is that you?", "buunny", """ Billy opens his eyes. Again, he is still dreaming. He can't see a plush toy, but from the dark corner of his bedroom a rustling emerges from one drawer. Billy leaves his room and enters the hall. From here he has access to the stairs, a bathroom and his parent's bedroom. As Billy slowly verges on the stairs he sees a bunny-shaped shadow across the wall, something's hopping up the stairs. His room seems no longer to be save, Billy really has no interest in meeting the thing that caused the rustling. He can either hide in the bathroom or in his parent's bedroom. """, """
def test_map(): start = Scene("Start", "You can go west and down a hole.") west = Scene("Tres", "There are trees here, you can go east.") down = Scene("Dungeon", "It's dark down here, you can go up.") start.add_paths({'west': west, 'down': down}) west.add_paths({'east': start}) down.add_paths({'up':start}) assert_equal(start.go('west'), west) assert_equal(start.go('west').go('east'), start) assert_equal(start.go('down').go('up'), start)
def test_map(): start = Scene("Start", "start", "You can go west to see the painting.") west = Scene("Sofa", "sofa", "There is a sofa here, you can seat.") down = Scene("Alarm", "alarm", "There is an alarm down there. You should be careful..") start.add_paths({'west': west, 'down': down}) west.add_paths({'east': start}) down.add_paths({'up': start}) assert_equal(start.go('west'), west) assert_equal(start.go('west').go('east'), start) assert_equal(start.go('down').go('up'), start)
from map import Scene # Creating the Scenes of the game central_corridor = Scene( "Central Corridor", "central_corridor", """ The Gothons of Planet Percal #25 have invaded your ship and destroyed your entire crew. You are the last surviving member (oh noes!) and your last mission is to get the neutron destruct bomb from the Weapons Armory, put it in the bridge, and blow up the ship after getting into an escape pod. You're now running down the central corridor to the Weapons Armory when a Gothon hops out in an evil clown costume filled with hate. He's blocking the door to the Armory and about to pull a weapon to blast you. """, """ You don't know what you should do now? You have three options. 1. shoot! (Offense is the best defense!) 2. dodge! (Be agile and use the moment of surprise!) 3. tell a joke (Paralyse the opponent with laughter!) """) laser_weapon_armory = Scene( "Laser Weapon Armory", "laser_weapon_armory", """ Lucky for you they made you learn Gothon insults in the academy. You tell the one Gothon joke you know: Lbhe zbgure vg fb sng, jura fur vfvg nebhaq gut ubhfr, fur fvgf nebhaq gut ubhfr. The Gothon bursts into laughter and rolls around on the ground. While its laughing you run up and use your copy of Nietzsche's notebooks (translated into Gothon) to lecture the Gothon on the shaky foundations of its ideologies. While it tries to cope with its existential crisis, you leap through the Weapon Armory door.