Agent_Silence

Puzzle

Jan 31st, 2015 (edited)
10
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.93 KB | None | 0 0
  1. local slots = {
  2. 0,
  3. 0,
  4. 0,
  5. 0,
  6. 0,
  7. 0,
  8. 0,
  9. 0,
  10. 0}
  11.  
  12. local combination = {
  13. 0,
  14. 1,
  15. 2,
  16. 3,
  17. 4,
  18. 5,
  19. 6,
  20. 7,
  21. 8}
  22. for i=1,9 do
  23.   peripheral.call("back","setSlot",i,{id = "minecraft:stained_glass_pane", dmg = slots[i]})
  24. end
  25. local points = 0
  26. while true do
  27.   local event, slot, side = os.pullEvent("slot_click")
  28.   if slots[slot] < 15 then
  29.     slots[slot] = slots[slot] + 1
  30.   else
  31.     slots[slot] = 0
  32.   end
  33.   peripheral.call("back","setSlot",slot,{id = "minecraft:stained_glass_pane", dmg = slots[slot]})
  34.   points = 0
  35.   for i=1,9 do
  36.     if slots[i] == combination[i] then
  37.       points = points + 1
  38.     end
  39.   end
  40.   if points == 9 then
  41.     commands.exec("give @p minecraft:diamond")
  42.     for i=1,9 do
  43.       local rnd = math.random(0,15)
  44.       combination[i] = rnd
  45.       print(i,":",rnd)
  46.       for i=1,9 do
  47.         slots[i] = 0
  48.         peripheral.call("back","setSlot",i,{id = "minecraft:stained_glass_pane", dmg = slots[i]})
  49.       end
  50.     end
  51.   end
  52. end
Add Comment
Please, Sign In to add comment