Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- queue_crater_village = {}
- sides = {}
- sides[1] = "left" -- Input
- sides[2] = "right" -- Output
- sides[3] = "back" -- Detectors
- outputColors = colors.black
- function push(list, value)
- table.insert(list, 1, value)
- end
- function pop(list)
- last = table.getn(list)
- value = list[last]
- table.remove(list, last)
- return value
- end
- while true do
- -- Inputs
- if colors.test(rs.getBundledInput(sides[1]), colors.white) then
- -- Wioska
- push(queue_crater_village, false)
- elseif colors.test(rs.getBundledInput(sides[1]), colors.orange) then
- -- Krater
- push(queue_crater_village, true)
- end
- -- Detectors
- if colors.test(rs.getBundledInput(sides[3]), colors.white) then
- crater = pop(queue_crater_village)
- if not colors.test(outputColors, colors.white) then
- outputColors = outputColors + colors.white
- end
- -- Wioska x Krater
- if not crater then
- outputColors = outputColors - colors.white
- end
- end
- rs.setBundledOutput(sides[2], outputColors)
- os.sleep(1)
- end
Advertisement
Add Comment
Please, Sign In to add comment