SHOW:
|
|
- or go back to the newest paste.
| 1 | turtle.refuel() -- might as well, :P | |
| 2 | ||
| 3 | while true do -- loop | |
| 4 | - | local action = math.random(1,9) -- Random movement generator |
| 4 | + | local action = math.random(1,12) -- Random movement generator |
| 5 | ||
| 6 | if action == 1 then -- forward | |
| 7 | for i = 1,5 do | |
| 8 | turtle.forward() | |
| 9 | end | |
| 10 | end | |
| 11 | ||
| 12 | if action == 2 then -- forward | |
| 13 | for i = 1,5 do | |
| 14 | turtle.forward() | |
| 15 | end | |
| 16 | end | |
| 17 | ||
| 18 | if action == 7 then -- forward | |
| 19 | for i = 1,5 do | |
| 20 | turtle.forward() | |
| 21 | end | |
| 22 | end | |
| 23 | ||
| 24 | if action == 8 then -- forward | |
| 25 | for i = 1,5 do | |
| 26 | turtle.forward() | |
| 27 | end | |
| 28 | end | |
| 29 | ||
| 30 | if action == 9 then -- forward | |
| 31 | for i = 1,5 do | |
| 32 | turtle.forward() | |
| 33 | end | |
| 34 | end | |
| 35 | ||
| 36 | if action == 3 then -- up | |
| 37 | turtle.up() | |
| 38 | end | |
| 39 | ||
| 40 | if action == 4 then -- down | |
| 41 | turtle.digDown() | |
| 42 | turtle.down() | |
| 43 | end | |
| 44 | ||
| 45 | if action == 10 then -- up | |
| 46 | for i = 1,5 do | |
| 47 | turtle.up() | |
| 48 | end | |
| 49 | end | |
| 50 | ||
| 51 | if action == 11 then -- down | |
| 52 | for i = 1,5 do | |
| 53 | turtle.down() | |
| 54 | end | |
| 55 | end | |
| 56 | ||
| 57 | if action == 5 then -- left | |
| 58 | turtle.turnLeft() | |
| 59 | end | |
| 60 | ||
| 61 | if action == 6 then -- right | |
| 62 | turtle.turnRight() | |
| 63 | end | |
| 64 | sleep(0.5) | |
| 65 | end -- end loop |