Beispiele und Musterlösungen
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

donkey.py 569B

2 months ago
123456789101112131415161718192021222324252627282930313233343536
  1. def turn_around():
  2. turn_left()
  3. turn_left()
  4. def turn_right():
  5. turn_left()
  6. turn_left()
  7. turn_left()
  8. def collect_star():
  9. if object_here():
  10. take()
  11. def collect_all_in_row():
  12. while front_is_clear():
  13. collect_star()
  14. move()
  15. collect_star()
  16. def move_up():
  17. turn_around()
  18. while wall_on_right():
  19. move()
  20. turn_right()
  21. move()
  22. turn_left()
  23. while front_is_clear():
  24. move()
  25. turn_around()
  26. think(3)
  27. for _ in range(8):
  28. collect_all_in_row()
  29. move_up()
  30. collect_all_in_row()