chekalin87

platform

May 16th, 2015
277
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.81 KB | None | 0 0
  1. local r = require("robot")
  2.  
  3. local function place()
  4.   r.swingUp()
  5.   r.swing()
  6.   r.swingDown()
  7.   r.placeDown()
  8. end
  9.  
  10. function move(m)
  11.   i=1
  12.   while i<=m do
  13.     place()
  14.     if r.forward()==true then
  15.       i=i+1
  16.     end
  17.   end
  18. end
  19.  
  20. function cicl()
  21.   move(a)
  22.   r.turnRight()
  23.   move(1)
  24.   r.turnRight()
  25.   move(a)
  26.   if not (q == (c+1)) then
  27.     r.turnLeft()
  28.     move(1)
  29.     r.turnLeft()  
  30.   end
  31. end
  32.  
  33. function shah()
  34.   while q <= c do
  35.    q=q+1  
  36.    cicl()
  37.   end
  38.   move(1)
  39.   r.turnRight()
  40.   move((c*2)+1)
  41.   r.turnRight()
  42. end
  43.  
  44.  
  45.  
  46. print("постройка платформы.")
  47. print("Введите длину платформы:")
  48. a = io.read() - 1
  49. print("Введите ширину:")
  50. c = (io.read() / 2) - 1
  51. q = 0
  52. shah()
  53. q = 0
  54. while (b =="Y") or (b == "y") do
  55.   shah()
  56. q = 0
  57. end
Advertisement
Add Comment
Please, Sign In to add comment