def test_ghastly_cannot_travel_through_room_boundaries(ui): ui, engine = init_tiny_room(ui) # Ghastly thinks that he can travel though wall and room boundaries # as it turns out, he cannot, but that won't stop him from trying. # He will try to walk through all 4 room boundaries of the 2 x 2 room. ui.say("Ghastly") # He starts in tile 0,0 and tries to go west through a wall ui.say("j") # Then he tries to go south through a wall ui.say("k") # These walls are solid and prevent me from travelling there. So he travels north twice. # The second movement is prevented by a wall ui.say("i") ui.say("i") # Now he tries the last wall by travelling east twice. But cannot travel through the east wall ui.say("l") ui.say("l") # Completely frustrated, Ghastly exits the level. ui.say("e") # Having seen all there is to see, he quits the game and tells all of his friends about # the cool map. ui.say("q") engine.main_loop() assert ui.output_anywhere("You cannot go north") assert ui.output_anywhere("You cannot go south") assert ui.output_anywhere("You cannot go east") assert ui.output_anywhere("You cannot go west")
def test_power_leveling_paula_delves_deeply(ui): ui, engine = init_tiny_room(ui) # Power leveling Paula likes to get through a game as quickly as possible. # She will be overjoyed to travel through three levels to complete the game as quickly # as possible ui.say("Paula") travel_to_the_next_level(ui) travel_to_the_next_level(ui) travel_to_the_next_level(ui) # Impressed by the game's literary acumen Leslie quits and writes a 5 star review ui.say("q") engine.main_loop() assert ui.output_anywhere("harrowed and tiny halls of doom") assert ui.output_anywhere("second of three tiny rooms") assert ui.output_anywhere("third and final tiny room") assert ui.output_anywhere("completed the game")
def test_literary_leslie_loves_lots_of_lively_loquaciousness(ui): ui, engine = init_tiny_room(ui) engine.room_file = "tiny_room.json" # Literary Leslie likes her games to have nice descriptions of things # She would like to see life breathed into this text adventure with wonderous words ui.say("h") ui.say("j") ui.say("k") ui.say("l") ui.say("Literary") assert not ui.output_anywhere("dark and moss covered") # She travels to the exit searching for words ui.say("k") ui.say("l") ui.say("e") # Impressed by the game's literary acumen Leslie quits and writes a 5 star review ui.say("q") engine.main_loop() assert ui.output_anywhere("dark and moss covered")