Advertisement
Guest User

Untitled

a guest
Apr 27th, 2017
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1. print("Welcome to the Danoli Roulette")
  2.  
  3.  
  4. os.pullEvent("redstone")
  5.  
  6.  
  7. print(" ")
  8.  
  9. print(" ")
  10.  
  11. print("You can bet on green, red and black")
  12.  
  13.  
  14. print(" ")
  15.  
  16. print(" ")
  17.  
  18. print("Type red, black or green underneat")
  19.  
  20.  
  21. local choices = {["red"]= 7, ["black"] = 7, ["green"]= 1}
  22.  
  23. local function roll(t, dice)
  24. if not dice then dice = 15 end
  25. local c = 0
  26. local r = math.random(dice)
  27. for i,n in pairs(t) do
  28. c = c + n
  29. if r <= c then
  30. return i
  31. end
  32. end
  33. end
  34.  
  35. print("Winning colour is ", roll(choices))
  36.  
  37. t = io.read()
  38.  
  39. m = roll(choices)
  40.  
  41. print(m)
  42.  
  43. if t == m then
  44.  
  45.  
  46. print("You win!")
  47.  
  48. rs.setOutput("back", true)
  49.  
  50.  
  51. rs.setOutput("back", true)
  52.  
  53.  
  54.  
  55. else
  56.  
  57.  
  58. print(" You lost ")
  59.  
  60. end
  61.  
  62. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement