Advertisement
Guest User

Измеритель прямоугольников

a guest
Jun 30th, 2015
275
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.32 KB | None | 0 0
  1. local r = require("robot")
  2. local w=0
  3. local l=0
  4. while (not r.detect()) and (r.detectDown()) do
  5. r.forward() w = w + 1 end;
  6. if not r.detectDown() then r.back() end;
  7. r.turnRight()
  8. while (not r.detect()) and (r.detectDown()) do
  9. r.forward() l = l + 1 end;
  10. if not r.detectDown() then r.back() end;
  11. print(w,l)
  12. print(w*l)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement