jerabina

Untitled

Aug 30th, 2016
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.47 KB | None | 0 0
  1. -- promenne --
  2.  
  3. do
  4. zetony = 0
  5. vyseSazky = 0
  6. a = 0
  7. b = 0
  8. c = 0
  9. vyhra = 0
  10. kolikDobit = 0
  11.  
  12. term.clear()
  13. end
  14.  
  15. -- vysvetleni principu hry --
  16.  
  17. do
  18. term.clear()
  19. x, y = term.getSize()
  20. term.setCursorPos(x/2-4, 2)
  21. print("AUTOMATY")
  22. textutils.slowPrint("---------------------------------------------------")
  23. print("Pokud vam padne 3x stejne cislo, vyhravate dvojnasobek vaseho vkladu")
  24. print("1 diamant = 1 zeton")
  25. print("Diamanty hazejte po vyzvani do vody vedle automatu")
  26. print("Pro pokracovani stisknete ENTER")
  27. io.read()
  28. term.clear()
  29. end
  30.  
  31. -- hlavni program --
  32.  
  33. while true do
  34. term.clear()
  35. x, y = term.getSize()
  36. term.setCursorPos(x/2-4, 2)
  37. print("AUTOMATY")
  38. print("---------------------------------------------------")
  39. print("Zvolte moznost:")
  40. print("1. Dobit zetony")
  41. print("2. Hrat automaty")
  42. print("3. Vybrat vyhru")
  43. print("4. Odejit")
  44. print("Vas pocet zetonu je: "..zetony)
  45. volba = read()
  46. volba = tonumber(volba)
  47.  
  48. if volba == 1 then
  49.  
  50. term.clear()
  51. x, y = term.getSize()
  52. term.setCursorPos(x/2-4, 2)
  53. print("AUTOMATY")
  54. print("---------------------------------------------------")
  55. print("Zadej, kolik zetonu chces dobit:")
  56. kolikDobit = read()
  57. kolikDobit = tonumber(kolikDobit)
  58.  
  59. p = kolikDobit
  60.  
  61. while p > 0 do
  62. os.pullEvent()
  63. if redstone.getInput("left") == true then
  64. zetony = zetony + 1
  65. p = p - 1
  66. print("Jeste zbyva "..p.." diamantu")
  67. sleep(1)
  68. end
  69. end
  70. elseif volba == 2 then
  71.  
  72. term.clear()
  73.  
  74. a = math.random(1,3)
  75. b = math.random(1,3)
  76. c = math.random(1,3)
  77.  
  78. x, y = term.getSize()
  79. term.setCursorPos(x/2-4, 2)
  80. print("AUTOMATY")
  81. print("---------------------------------------------------")
  82. print("Vas pocet zetonu je: "..zetony)
  83. print("Zadejte o kolik zetonu chcete hrat")
  84. vyseSazky = read()
  85. vyseSazky = tonumber(vyseSazky)
  86. term.clear()
  87.  
  88. if vyseSazky > zetony then
  89. x, y = term.getSize()
  90. term.setCursorPos(x/2-4, 2)
  91. print("AUTOMATY")
  92. print("---------------------------------------------------")
  93. print("Nemate dostatek zetonu, dobijte si prosim")
  94. sleep(1)
  95. else
  96. if a == b then
  97. if a == c then
  98. if b == c then
  99. x, y = term.getSize()
  100. term.setCursorPos(x/2-4, 2)
  101. print("AUTOMATY")
  102. print("---------------------------------------------------")
  103. term.setCursorPos(x/2-15, 10)
  104. print("\/ "..a.." \/ "..b.." \/ "..c.." \/")
  105. term.setCursorPos(x/2-17, 10)
  106. print("Vyhral jste dvojnasobek vsazene castky!!!")
  107. zetony = zetony + vyseSazky * 2
  108. sleep(2)
  109. end
  110. else
  111. x, y = term.getSize()
  112. term.setCursorPos(x/2-4, 2)
  113. print("AUTOMATY")
  114. print("---------------------------------------------------")
  115. term.setCursorPos(x/2-6, 10)
  116. print("\/ "..a.." \/ "..b.." \/ "..c.." \/")
  117. term.setCursorPos(x/2-6, 10)
  118. print("Prohral jste!")
  119. zetony = zetony - vyseSazky
  120. sleep(2)
  121. end
  122. else
  123. x, y = term.getSize()
  124. term.setCursorPos(x/2-4, 2)
  125. print("AUTOMATY")
  126. print("---------------------------------------------------")
  127. term.setCursorPos(x/2-6, 10)
  128. print("\/ "..a.." \/ "..b.." \/ "..c.." \/")
  129. term.setCursorPos(x/2-6, 10)
  130. print("Prohral jste!")
  131. zetony = zetony - vyseSazky
  132. sleep(2)
  133. end
  134. end
  135.  
  136. elseif volba == 3 then
  137.  
  138. term.clear()
  139.  
  140. if zetony > 0 then
  141. print("Je vam vyplacena vyhra")
  142.  
  143. i = zetony
  144.  
  145. while i > 0 do
  146. sleep(1)
  147. redstone.setOutput("back", true)
  148. sleep(1)
  149. redstone.setOutput("back", false)
  150. i = i - 1
  151. end
  152. term.clear()
  153. print("Vyhra byla vyplacena")
  154. zetony = 0
  155. sleep(3)
  156. else
  157. term.clear()
  158. x, y = term.getSize()
  159. term.setCursorPos(x/2-4, 2)
  160. print("AUTOMATY")
  161. print("---------------------------------------------------")
  162. print("Nemate zadne zetony na vyplaceni")
  163. sleep(3)
  164. end
  165.  
  166. elseif volba == 4 then
  167. term.clear()
  168. x, y = term.getSize()
  169. term.setCursorPos(x/2-4, 2)
  170. print("AUTOMATY")
  171. print("---------------------------------------------------")
  172. print("Navidenou a preji hezky zbytek dne")
  173. sleep(3)
  174. term.clear()
  175. break
  176.  
  177. else
  178. x, y = term.getSize()
  179. term.setCursorPos(x/2-4, 2)
  180. print("AUTOMATY")
  181. print("---------------------------------------------------")
  182. print("Neplatna volba")
  183. sleep(3)
  184. end
  185. end
Add Comment
Please, Sign In to add comment