Advertisement
le_Fish

Untitled

Jul 5th, 2020
1,015
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 4.85 KB | None | 0 0
  1.  
  2. fake_x,fake_y = 1,0
  3. x,y = -13,10
  4. delta = {1,0}
  5.  
  6. function spiral()
  7.     local pos = {true,true}
  8.     pos[1] = fake_x
  9.     pos[2] = fake_y
  10.  
  11.     if fake_x == fake_y or (fake_x < 0 and fake_x == -fake_y) or (fake_x > 0 and fake_x == 1-fake_y) then
  12.         delta = {-delta[2], delta[1]}
  13.     end
  14.  
  15.     fake_x = fake_x + delta[1]
  16.     fake_y = fake_y + delta[2]
  17.     print(fake_x .. " F " .. fake_y)
  18.     print(delta[1] .. " D " .. delta[2])
  19.  
  20.     return pos
  21. end
  22.  
  23. local newLocation
  24. newLocation = spiral()
  25. print(x + newLocation[1] .. " R " .. y + newLocation[2])
  26. sleep(1)
  27. newLocation = spiral()
  28. print(x + newLocation[1] .. " R " .. y + newLocation[2])
  29. sleep(1)
  30. newLocation = spiral()
  31. print(x + newLocation[1] .. " R " .. y + newLocation[2])
  32. sleep(1)
  33. newLocation = spiral()
  34. print(x + newLocation[1] .. " R " .. y + newLocation[2])
  35. sleep(1)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement