Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- print("Welcome to the Danoli Roulette")
- os.pullEvent("redstone")
- print(" ")
- print(" ")
- print("You can bet on green, red and black")
- print(" ")
- print(" ")
- print("Type red, black or green underneat")
- local choices = {["red"]= 7, ["black"] = 7, ["green"]= 1}
- local function roll(t, dice)
- if not dice then dice = 15 end
- local c = 0
- local r = math.random(dice)
- for i,n in pairs(t) do
- c = c + n
- if r <= c then
- return i
- end
- end
- end
- print("Winning colour is ", roll(choices))
- t = io.read()
- m = roll(choices)
- print(m)
- if t == m then
- print("You win!")
- rs.setOutput("back", true)
- rs.setOutput("back", true)
- else
- print(" You lost ")
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement