Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- disc = peripheral.wrap("bottom")
- mon = peripheral.wrap("top")
- mon.clear()
- mon.setCursorPos(1,1)
- side = "back"
- function disk()
- os.pullEvent("disk")
- if disc.getLabel() == "SLOTS" and fs.exists("disk/.slots") == true then
- local file = fs.open("disk/.slots", "r")
- if file then
- tokens = file.readLine()
- file.close()
- end
- end
- disc.eject()
- mon.clear()
- end
- term.clear()
- term.setCursorPos(1,1)
- function won()
- mon.write("YOU WON!!!")
- end
- function lost()
- mon.write("YOU LOST ")
- end
- c1 = colors.white
- c2 = colors.orange
- c3 = colors.magenta
- c4 = colors.lightBlue
- c5 = colors.yellow
- c6 = colors.lime
- c7 = colors.pink
- c8 = colors.gray
- c9 = colors.lightGray
- c10 = colors.cyan
- c11 = colors.purple
- c12 = colors.blue
- c13 = colors.brown
- c14 = colors.green
- c15 = colors.red
- c16 = colors.black
- line1 = " =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-="
- line2 = " -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-"
- line = 0
- while true do
- mon.clear()
- mon.setCursorPos(1,1)
- mon.write(line1)
- mon.setCursorPos(1,17)
- mon.write(line2)
- mon.setCursorPos(2,2)
- mon.write("Tokens: "..tokens.." ")
- mon.setCursorPos(5,9)
- mon.write("PLEASE ENTER TOKENS TO PLAY")
- disk()
- for i=1,tokens do
- sleep(1)
- rs.setBundledOutput("back", 0)
- mon.setCursorPos(2,2)
- tokens = tokens - 1
- mon.write("Tokens: "..tokens.." ")
- for i=1,10 do
- mon.setCursorPos(1,1)
- if line == 0 then
- mon.write(line1)
- line = 1
- else
- mon.write(line2)
- line = 0
- end
- mon.setCursorPos(1,17)
- if line == 0 then
- mon.write(line2)
- else
- mon.write(line1)
- end
- a = math.random(8)
- b = math.random(8)
- c = math.random(8)
- mon.setCursorPos(10,9)
- mon.write(a.." - "..b.." - "..c)
- sleep(0.5)
- end
- sleep(0.5)
- mon.setCursorPos(10,9)
- mon.write(a.." - "..b.." - "..c)
- mon.setCursorPos(10,7)
- if a == b and b == c then
- won()
- if b == 8 then
- rs.setBundledOutput(side, c1)
- elseif b == 7 then
- rs.setBundledOutput(side, c2)
- elseif b == 6 then
- rs.setBundledOutput(side, c3)
- elseif b == 5 then
- rs.setBundledOutput(side, c4)
- elseif b == 4 then
- rs.setBundledOutput(side, c5)
- elseif b == 3 then
- rs.setBundledOutput(side, c6)
- elseif b == 2 then
- rs.setBundledOutput(side, c7)
- elseif b == 1 then
- rs.setBundledOutput(side, c8)
- end
- elseif a == b or b == c then
- won()
- if b == 8 then
- rs.setBundledOutput(side, c9)
- elseif b == 7 then
- rs.setBundledOutput(side, c10)
- elseif b == 6 then
- rs.setBundledOutput(side, c11)
- elseif b == 5 then
- rs.setBundledOutput(side, c12)
- elseif b == 4 then
- rs.setBundledOutput(side, c13)
- elseif b == 3 then
- rs.setBundledOutput(side, c14)
- elseif b == 2 then
- rs.setBundledOutput(side, c15)
- elseif b == 1 then
- rs.setBundledOutput(side, c16)
- end
- else
- lost()
- end
- sleep(2)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement