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.

2 months ago
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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 set_stars():
  9. move()
  10. while wall_on_right():
  11. put()
  12. move()
  13. def move_to_start():
  14. turn_right()
  15. move()
  16. turn_right()
  17. while right_is_clear():
  18. move()
  19. while wall_on_right():
  20. move()
  21. turn_right()
  22. move()
  23. turn_right()
  24. move()
  25. def move_to_last_star():
  26. while object_here():
  27. move()
  28. turn_around()
  29. move()
  30. turn_around()
  31. def move_to_end():
  32. while front_is_clear():
  33. move()
  34. def count_stars():
  35. move_to_start()
  36. while object_here():
  37. move_to_last_star()
  38. if object_here():
  39. take()
  40. move_to_end()
  41. put()
  42. move_to_start()
  43. set_stars()
  44. count_stars()