while true do
ticket = 0
sleep(0.1)
if rs.getInput(“back”, true) then
repeat
rs.setOutput(“rigth”, true)
sleep(0.2)
rs.setOutput(“rigth”, false)
sleep(0.3)
ticket = ticket + 1
if rs.getOutput(“back”, true) then
rssig = 1
else
rssig = 2
until rssig == 2
for i = 1,ticket do
if rs.getInput(“top”, true) then
random = math.random(1)
if random == 1 then
rs.setOutput(“front”, true)
sleep(0.2)
rs.setOutput(“front”, false)
sleep(0.2)
end
end
end
end
end