hevohevo

CC実況20220716: tofu.lua

Jul 16th, 2022
1,242
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.64 KB | None | 0 0
  1. --------------------------
  2. -- パラメーター
  3. local hen = 5
  4. local takasa = 3
  5.  
  6.  
  7.  
  8. --------------------------
  9. -- サブ関数部分
  10.  
  11. -- 下にブロック置いて、前に進むを n 回繰り返す
  12. function shitamae(n)
  13.   for i=1,n do
  14.     turtle.placeDown()
  15.     turtle.forward()
  16.   end
  17. end
  18.  
  19. -- 真下に一辺が n+1 の正方形にブロックを置く
  20. function seihoukei(n)
  21.   for i=1,4 do
  22.     shitamae(n)
  23.     turtle.turnRight()
  24.   end
  25. end
  26.  
  27. --------------------------
  28. -- メイン部分
  29. for y=1,takasa do
  30.   turtle.up()
  31.   seihoukei(hen)
  32. end
  33.  
  34. turtle.turnRight()
  35. turtle.forward()
  36. turtle.turnLeft()
  37. turtle.forward()
  38.  
  39.  
  40.  
  41.  
Advertisement
Add Comment
Please, Sign In to add comment