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.

pyramide.py 1.0KB

2 months ago
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. def turn_right():
  2. turn_left()
  3. turn_left()
  4. turn_left()
  5. def turn_around():
  6. turn_left()
  7. turn_left()
  8. def set_stone_above():
  9. turn_left()
  10. move()
  11. put()
  12. turn_right()
  13. move()
  14. turn_right()
  15. move()
  16. turn_left()
  17. def build_first_row():
  18. while front_is_clear():
  19. put()
  20. move()
  21. put()
  22. turn_around()
  23. while front_is_clear():
  24. move()
  25. turn_around()
  26. def build_second_row():
  27. move()
  28. while front_is_clear():
  29. set_stone_above()
  30. turn_left()
  31. move()
  32. turn_left()
  33. move()
  34. while object_here():
  35. move()
  36. turn_around()
  37. move()
  38. def build_next_row():
  39. move()
  40. while object_here():
  41. set_stone_above()
  42. turn_left()
  43. move()
  44. turn_left()
  45. move()
  46. if object_here():
  47. take()
  48. move()
  49. while object_here():
  50. move()
  51. turn_around()
  52. move()
  53. think(3)
  54. set_trace_style("invisible")
  55. build_first_row()
  56. build_second_row()
  57. while object_here():
  58. build_next_row()