Advertisement
Guest User

game

a guest
Apr 27th, 2017
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.49 KB | None | 0 0
  1. print("Welcome to Danamic Casino, a computercraft roulette game, insert a gold bar to play!")
  2.  
  3.  
  4. os.pullEvent("redstone")
  5.  
  6.  
  7. print(" ")
  8.  
  9. print(" ")
  10.  
  11. print("You can bet on your number being greater than 25, less than 26 or a single number between 1 and 50")
  12.  
  13.  
  14. print(" ")
  15.  
  16. print(" ")
  17.  
  18. print(" Type and enter less, more or number now please ")
  19.  
  20.  
  21. x = io.read()
  22.  
  23.    
  24.     if x == "less" then
  25.  
  26.    
  27.     y = math.random(1, 50)
  28.  
  29.        
  30.     print(y)
  31.        
  32.         if y > 25 then
  33.  
  34.            
  35.         print(" Oh no! You lost D: ")
  36.  
  37.        
  38.         end -- lose
  39.            
  40.             if y < 26 then
  41.  
  42.            
  43.             print(" You won two gold bars! :D ")
  44.  
  45.            
  46.             rs.setOutput("right", true)
  47.  
  48.            
  49.             rs.setOutput("right",true)
  50.  
  51.            
  52.             end -- less
  53.  
  54.    
  55.     end -- <26
  56.  
  57.    
  58.    
  59.  
  60.     if x == "more" then
  61.  
  62.        
  63.     p = math.random(1, 50)
  64.  
  65.        
  66.     print(p)
  67.        
  68.         if p < 26 then
  69.  
  70.            
  71.         print(" Sorry, you lost D: ")
  72.  
  73.        
  74.         end -- lose
  75.            
  76.             if p > 25 then
  77.  
  78.            
  79.             print(" You won two gold bars! :D ")
  80.  
  81.            
  82.             rs.setOutput("right", true)
  83.  
  84.            
  85.             rs.setOutput("right", true)
  86.            
  87.             end -- less
  88.    
  89.     end
  90.    
  91.  
  92.     if x == "number" then
  93.    
  94.     print("Please enter a number between 1 and 50 now.")
  95.    
  96.     t = io.read()
  97.    
  98.     m = math.random(1, 50)
  99.  
  100.     print(m)
  101.        
  102.         if t == m then
  103.  
  104.        
  105.         print("You have won 2 diamonds!")
  106.        
  107.         rs.setOutput("back", true)
  108.  
  109.        
  110.         rs.setOutput("back", true)
  111.  
  112.  
  113.            
  114.         else
  115.  
  116.            
  117.         print(" You lost, the odds were against you >:D ")
  118.      
  119.         end -- if t = m
  120.              
  121. -- if m not equal to t
  122. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement