home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / logo / labybug / robot.bug < prev    next >
Text File  |  1989-02-05  |  1KB  |  103 lines

  1. to "poly  :d :a
  2. forward :d
  3. right :a
  4. poly :d :a
  5. end
  6.  
  7. to "drive  
  8. FORWARD 5
  9. YES.MASTER
  10. DRIVE
  11. end
  12.  
  13. to "yes.master  
  14. MAKE "C READKEY
  15. IF :C = "R THEN RIGHT 30
  16. IF :C = "L THEN LEFT 30
  17. IF :C = "U THEN PENUP
  18. IF :C = "D THEN PENDOWN
  19. IF :C = "Q THEN QUIT
  20. IF :C = "S THEN MAKE "SPEED :SPEED + 2
  21. end
  22.  
  23. make "c "'FALSE
  24. to "readkey  
  25. IF KEYP THEN OUTPUT READCHAR
  26. OUTPUT "FALSE
  27. end
  28.  
  29. to "quit  
  30. TOPLEVEL
  31. end
  32.  
  33. to "abs  :N
  34. IF :N <0 THEN OUTPUT :N
  35. OUTPUT :N
  36. end
  37.  
  38. to "drivea  
  39. FORWARD 5
  40. IF ABS XCOR > 200 THEN RIGHT 120
  41. IF ABS YCOR > 100 THEN RIGHT 120
  42. DRIVEA
  43. end
  44.  
  45. to "and     :a :b
  46. if :a = "true [output :b = "true]
  47. output "false
  48. end
  49.  
  50. to "or     :a :b
  51. if :a = "true [output "true]
  52. output :b = "true
  53. end
  54.  
  55. to "while     :condition :list
  56. if ( run :condition ) = "false then stop
  57. run :list
  58. while :condition :list
  59. end
  60.  
  61. to "forever     :list
  62. repeat 32000 :list
  63. forever :list
  64. end
  65.  
  66. to "xor     :a :b
  67. if :a = "true [output :b = "false]
  68. output :b = "true
  69. end
  70.  
  71. to "wait    :seconds
  72. tone 32000  20 * :seconds
  73. tone 32000 1  ;above times the wait; this makes us wait
  74. end
  75.  
  76. to "max    :a :b
  77. if :a > :b [output :a]
  78. output :b
  79. end
  80.  
  81. to "min    :a :b
  82. if :a > :b [output :b]
  83. output :a
  84. end
  85.  
  86. to "start  
  87. SETH 30
  88. MAKE "SPEED 5
  89. DRIVEB
  90. end
  91.  
  92. to "driveb  
  93. FORWARD :SPEED
  94. YES.MASTER
  95. DRIVEB
  96. end
  97.  
  98. make "speed "'35
  99. to "start  
  100. SETH 30
  101. MAKE "SPEED 5
  102. DRIVEB
  103. en