Advertisement
Guest User

Untitled

a guest
Aug 30th, 2016
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.65 KB | None | 0 0
  1. -- promenne --
  2.  
  3. do
  4. zetony = 0
  5. vyseSazky = 0
  6. rng1 = 0
  7. rng2 = 0
  8. rng3 = 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. textutils.slowPrint("---------------------------------------------------")
  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. print("Zadej, kolik zetonu chces dobit:")
  52. kolikDobit = read()
  53. kolikDobit = tonumber(kolikDobit)
  54.  
  55. p = kolikDobit
  56.  
  57. while p > 0 do
  58. os.pullEvent()
  59. if redstone.getInput("left") == true then
  60. zetony = zetony + 1
  61. print("Vas pocet zetonu je: "..zetony)
  62. p = p - 1
  63. sleep(1)
  64. end
  65. end
  66. elseif volba == 2 then
  67.  
  68. term.clear()
  69.  
  70. rng1 = math.random(1,3)
  71. rng2 = math.random(1,3)
  72. rng3 = math.random(1,3)
  73.  
  74. x, y = term.getSize()
  75. term.setCursorPos(x/2-4, 2)
  76. print("AUTOMATY")
  77. textutils.slowPrint("---------------------------------------------------")
  78. print("Vas pocet zetonu je: "..zetony)
  79. print("Zadejte o kolik zetonu chcete hrat")
  80. vyseSazky = read()
  81. vyseSazky = tonumber(vyseSazky)
  82.  
  83. if vyseSazky > zetony then
  84. print("Nemate dostatek zetonu, dobijte si prosim")
  85. sleep(1)
  86. else
  87. if a == b then
  88. if a == c then
  89. if b == c then
  90. print("Vyhral jste!!!")
  91. zetony = vyseSazky * 2
  92. end
  93. else
  94. print("Prohral jste!")
  95. zetony = zetony - vyseSazky
  96. end
  97. else
  98. print("Prohral jste!")
  99. zetony = zetony - vyseSazky
  100. end
  101. end
  102.  
  103. elseif volba == 3 then
  104.  
  105. term.clear()
  106.  
  107. if zetony > 0 then
  108. print("Je vam vyplacena vyhra")
  109.  
  110. i = zetony
  111.  
  112. while i > 0 do
  113. sleep(1)
  114. redstone.setOutput("back", true)
  115. sleep(1)
  116. redstone.setOutput("back, false")
  117. i = i - 1
  118. end
  119. term.clear()
  120. print("Vyhra byla vyplacena")
  121. else
  122. print("Nemate zadne zetony na vyplaceni")
  123. end
  124.  
  125. else
  126. break
  127. end
  128. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement