stage.set_background("concert")
sprite = codesters.Sprite("person1")
sprite.set_speed(3)
sprite.move_down(100)
sprite.flip_up_down()
sprite.move_right(150)
sprite.move_left(200)
sprite.flip_up_down()
sprite.turn_left(360)
stage.wait(.75)
sprite.flip_right_left()
stage.wait(.75)
sprite.flip_right_left()
stage.wait(.75)
sprite.flip_right_left()
stage.wait(.75)
sprite.flip_right_left()
stage.wait(.75)
sprite.flip_right_left()
stage.wait(.75)
sprite.flip_right_left()
t = codesters.Teacher()
flips = t.find_function('flip_up_down') #2
downs = t.find_function('move_down') #1
rights = t.find_function('move_right') #1
lefts = t.find_function('move_left') #1
sides = t.find_function('flip_right_left') #6
glides = t.find_function('glide_to') #0
ups = t.find_function('move_up') #0
forwards = t.find_function('move_forward') #0
backs = t.find_function('move_back') #0
turnslefts = t.find_function('turn_left') #1
turnsrights = t.find_function('turn_right') #0
sprites = t.find_function('Sprite')
spritesnames = t.get_parameters_for_function('Sprite')
try:
tval1 = stage.get_image_name()
except:
tval1 = "DNE"
try:
tval2 = spritesnames[0][0]
except:
tval2 = "DNE"
try:
tval3 = sprites[1][1]
except:
tval3 = "DNE"
if tval3 != "DNE":
new_sprite_name = tval3.split()[0]
new_sprites = t.find_text(new_sprite_name)
num_new_sprites = len(new_sprites)
req2 = (len(flips) > 2 or len(downs) > 1 or len(rights) > 1 or len(lefts) > 1 or len(sides) > 6 or len(glides) > 0 or len(ups) > 0 or len(forwards) > 0 or len(backs) > 0 or len(turnslefts) > 1 or len(turnsrights) > 0)
t1 = TestObjective()
t1.add_success(tval1 != "concert" or tval2 != '"person1"', "Great job!")
t1.add_failure(tval1 == "concert" and tval2 == '"person1"', "Make sure you meet Requirement #1")
t2 = TestObjective()
t2.add_success(req2, "Great job!")
t2.add_failure(req2 == False, "Make sure you meet requirement #2!")
t3 = TestObjective()
t3.add_success(tval3 != "DNE" and num_new_sprites > 1, "Great job!")
t3.add_failure(tval3 == "DNE", "Did you add a new sprite for Requirement #3?")
t3.add_failure(tval3 != "DNE" and num_new_sprites <= 1, "Did you add actions to make your new sprite dance?")
tester = TestManager()
tester.add_test_list([t1, t2, t3])
tester.run_tests()
tester.display_first_feedback()
-
Run Code
-
Activity Submitted!
Submit Work
-
Next Activity
-
Stop Running Code
-
Show Chart
-
Show Console
-
Reset Code Editor
-
Codesters How To (opens in a new tab)