Advertisement
Guest User

per

a guest
Jan 21st, 2017
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.02 KB | None | 0 0
  1. maxChange = 2
  2.  
  3. mon = peripheral.wrap("right")
  4.  
  5. x, y = mon.getSize()
  6. ceny = y / 2
  7.  
  8. height = ceny
  9.  
  10.  
  11.  
  12. function draw(coll)
  13.   mon.setCursorPos(coll, height)
  14.   for i = height, y do
  15.     mon.setCursorPos(coll, i)
  16.     mon.write(" ")
  17.   end
  18.   sleep()  
  19. end
  20.  
  21. function perlin()
  22.   step = 0
  23.   repeat
  24.     rand = math.random()
  25.     sleep()  
  26.     if rand > 0.8 then
  27.       randup = math.random(maxChange)
  28.       --if randup < 1.9999 then
  29.         up = 1
  30.       --else
  31.         --up = 2
  32.       --end
  33.       height = height + up
  34.       draw(step)
  35.     elseif rand < 0.2 then
  36.       randdown = math.random(maxChange)
  37.       --if randdown < 1.9999 then
  38.         down = 1
  39.       --else
  40.       --  down = 2
  41.       --end
  42.       height = height - down
  43.       draw(step)
  44.     else
  45.       draw(step)
  46.     end
  47.     step = step + 1
  48.   until step == legnth
  49. end
  50.  
  51. while true do
  52.   legnth = x
  53.   height = ceny
  54.   perlin()
  55.   mon.setBackgroundColor(colors.black)
  56.   mon.clear()
  57.   mon.setBackgroundColor(colors.white)
  58.   sleep(1)
  59. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement