sprite = codesters.Sprite("knight1", -175, -150)
sprite.set_speed(2)
def park_scene():
stage.set_background("park")
sprite.say("I should hurry to the castle!")
sprite.move_forward(550)
park_scene()
t = codesters.Teacher()
try:
func = t.find_text('def bridge_scene')
tval1 = func[0][1]
except:
func = "DNE"
tval1 = "DNE"
try:
setting = t.find_text('stage')
line = setting[1][0]
tval2 = t.get_indent_at_line(line)
tval3 = setting[1][1]
except:
setting = "DNE"
line = "DNE"
tval2 = "DNE"
tval3 = "DNE"
t1 = TestObjective()
t1.add_success('def bridge_scene():' in tval1, "Great job!")
t1.add_failure('bridge_scene' not in tval1, "Did you create a function and name it bridge_scene?")
t2 = TestObjective()
t2.add_success(tval2 == 4 and 'drawbridge' in tval3, "Graet job!")
t2.add_failure('stage' not in tval3, "Did you put a stage backgound in your function?")
t2.add_failure(tval2 < 4, "Did you indent your background in your function?")
t2.add_failure(tval2 > 4, "Make sure your background is nested 4 spaces inside your function.")
t2.add_failure('drawbridge' not in tval3, "It looks like you chose a different background image, try choosing a background to match your function name.")
tester = TestManager()
tester.add_test_list([t1, t2])
tester.run_tests()
tester.display_first_feedback()