stage.set_axis(8)
stage.create_grid_overlay(1, "black")
# hat = codesters.Sprite("fleecehat", 5, -6)
# hat.set_size(.5)
# hat.turn_right(70)
# flake1 = codesters.Sprite("snowflake1", 5, 0)
# flake1.set_size(.5)
# flake2 = codesters.Sprite("snowflake2", 0, 6)
# flake2.set_size(.5)
# flake3 = codesters.Sprite("snowflake3", -7, 2)
# flake3.set_size(.5)
# sweater = codesters.Sprite("sweater", -7, -4)
# sweater.turn_left(80)
# sweater.set_size(.5)
stage.set_background("winter")
sprite = codesters.Sprite("snowman")
sprite.set_size(.5)
t = codesters.Teacher()
glides = t.find_function("glide_to")
pens = t.find_function('pen_down')
try:
tval1 = pens[0][0]
tval1a = pens[0][1]
except:
tval1 = "DNE"
tval1a = "DNE"
try:
tval2 = glides[0][0]
except:
tval2 = "DNE"
t1 = TestObjective()
t1.add_success('sprite' in tval1a and tval1 < tval2, "Great job!")
t1.add_failure(tval1 == "DNE", "Did you add a Pen Down command?")
t1.add_failure(tval2 < tval1, "Oops! Make sure you added your Pen Down command before your Glide To command!")
t1.add_failure('sprite' not in tval1a, "Make sure your Pen Down command is assigned to your sprite.")
t2 = TestObjective()
t2.add_success(tval2 > tval1, "Great job!")
t2.add_failure(tval2 == "DNE", "Did you add a Glide To command?")
t2.add_failure(tval2 < tval1, "Oops! Make sure your Pen Down command comes before your Glide To command!")
tester = TestManager()
tester.add_test_list([t1, t2])
tester.run_tests()
tester.display_first_feedback()
-
Run Code
-
Activity Submitted!
Enviar Trabajo
-
Actividad Siguiente
-
Stop Running Code
-
Show Chart
-
Show Console
-
Reset Code Editor
-
Codesters How To (opens in a new tab)