Advertisement
_GameDoctor_

casino

Aug 13th, 2021
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.49 KB | None | 0 0
  1. local os = require("os")
  2. print("Made by GameDoctor")
  3. print("Запуск программы...")
  4. os.sleep(2)
  5.  
  6.  
  7. local comp = require("computer")
  8. local co = require("component")
  9. local term = require("term")
  10. local gpu = co.gpu
  11. gpu.setResolution(40,20)
  12. local w, h = gpu.getResolution()
  13. local event = require("event")
  14. local d = 0
  15. local wins = 0
  16. local loses = 0
  17.  
  18. function main()
  19. gpu.setResolution(40,20)
  20. term.clear()
  21. a=gpu.setBackground(0x008000)
  22. term.clear()
  23. gpu.setBackground(0x000000)
  24. b=gpu.setForeground(0x00FF00)
  25. gpu.fill(1,1,w,2," ")
  26. gpu.setBackground(0xFFFFFF)
  27. gpu.fill(5,8,31,12," ")
  28. gpu.setBackground(0xFFFFFF)
  29. gpu.setForeground(0xFF0000)
  30. term.setCursor(8,14)
  31. term.write(" ")
  32. term.setCursor(w/2,14)
  33. term.write(" ")
  34. term.setCursor(w-8,14)
  35. term.write(" ")
  36. gpu.setForeground(0x000000)
  37. gpu.fill(14,8,1,12,"|")
  38. gpu.fill(w-14,8,1,12,"|")
  39. gpu.setForeground(0x00FF00)
  40. gpu.setBackground(0x000000)
  41.  
  42. end
  43.  
  44. function semerka(x,y)
  45. kekosi = gpu.setBackground(0xFF0000)
  46. kekchi = gpu.setForeground(0xFF0000)
  47. gpu.set(x-2,y-1," ")
  48. gpu.set(x-1,y-1," ")
  49.  
  50. gpu.set(x,y-1," ")
  51. gpu.set(x,y," ")
  52. gpu.set(x-1,y+1," ")
  53. gpu.set(x-1,y+2," ")
  54. gpu.setBackground(kekosi)
  55. gpu.setForeground(kekchi)
  56. end
  57.  
  58. function game()
  59. for i=1,2 do
  60. gpu.setBackground(0x000000)
  61. gpu.fill(6,12,1,2," ")
  62. gpu.fill(10,12,1,2," ")
  63. gpu.fill(8,14,1,2," ")
  64. gpu.fill(18,12,1,2," ")
  65. gpu.fill(22,12,1,2," ")
  66. gpu.fill(20,14,1,2," ")
  67. gpu.fill(w-6,12,1,2," ")
  68. gpu.fill(w-10,12,1,2," ")
  69. gpu.fill(w-8,14,1,2," ")
  70. os.sleep(0.4)
  71. gpu.setBackground(0xFFFFFF)
  72. gpu.fill(6,12,1,2," ")
  73. gpu.fill(10,12,1,2," ")
  74. gpu.fill(8,14,1,2," ")
  75. gpu.fill(18,12,1,2," ")
  76. gpu.fill(22,12,1,2," ")
  77. gpu.fill(20,14,1,2," ")
  78. gpu.fill(w-6,12,1,2," ")
  79. gpu.fill(w-10,12,1,2," ")
  80. gpu.fill(w-8,14,1,2," ")
  81. os.sleep(0.5)
  82. gpu.setBackground(0x000000)
  83. gpu.fill(6,14,1,2," ")
  84. gpu.fill(10,14,1,2," ")
  85. gpu.fill(8,12,1,2," ")
  86. gpu.fill(18,14,1,2," ")
  87. gpu.fill(22,14,1,2," ")
  88. gpu.fill(20,12,1,2," ")
  89. gpu.fill(w-6,14,1,2," ")
  90. gpu.fill(w-10,14,1,2," ")
  91. gpu.fill(w-8,12,1,2," ")
  92. gpu.setBackground(0xFFFFFF)
  93. os.sleep(0.5)
  94. gpu.fill(6,14,1,2," ")
  95. gpu.fill(10,14,1,2," ")
  96. gpu.fill(8,12,1,2," ")
  97. gpu.fill((w/2)-2,14,1,2," ")
  98. gpu.fill((w/2)+2,14,1,2," ")
  99. gpu.fill(w/2,12,1,3," ")
  100. gpu.fill(w-6,14,1,2," ")
  101. gpu.fill(w-10,14,1,2," ")
  102. gpu.fill(w-8,12,1,2," ")
  103. os.sleep(0.5)
  104. end
  105. gpu.setBackground(0x000000)
  106. local na = math.random(1,2)
  107. local nb = math.random(1,2)
  108. local nc = math.random(1,2)
  109. term.setCursor(8,15)
  110. term.write(math.floor(na))
  111. term.setCursor(w/2,15)
  112. term.write(math.floor(nb))
  113. term.setCursor(w-8,15)
  114. term.write(math.floor(nc))
  115. os.sleep(2)
  116. if na == nb and nb == nc then
  117. gpu.fill(5,8,31,12," ")
  118. term.setCursor((w/2)-5,h/2)
  119. term.write("ВЫ ВЫИГРАЛИ :)")
  120. wins = wins + 1
  121. local red = co.redstone
  122. red.setOutput(1, 15)
  123. red.setOutput(1, 0)
  124. os.sleep(3)
  125. else
  126. gpu.fill(5,8,31,12," ")
  127. term.setCursor((w/2)-5,h/2)
  128. term.write("ВЫ ПРОИГРАЛИ :(")
  129. loses = loses + 1
  130. os.sleep(2)
  131. end
  132. end
  133.  
  134. function clearB()
  135. asl=gpu.setForeground(0xFFFFFF)
  136. gpu.setBackground(0xFFFFFF)
  137. gpu.fill(5,8,31,12," ")
  138. gpu.setForeground(0x000000)
  139. gpu.fill(14,8,1,12,"|")
  140. gpu.fill(w-14,8,1,12,"|")
  141. gpu.setForeground(asl)
  142. end
  143.  
  144. function drawbutton(bID)
  145. cy=gpu.setBackground(bID[6])
  146. gpu.fill(bID[2],bID[3],bID[4],bID[5]," ")
  147. term.setCursor(bID[2],bID[3]+bID[5]/2)
  148. acy=gpu.setForeground(0x000000)
  149. term.write(bID[1])
  150. gpu.setBackground(cy)
  151. gpu.setForeground(acy)
  152. end
  153.  
  154. function clicker()
  155. local stb={"СТАРТ",2,3,5,1,0xDAA520,clicked,output}
  156. local stb1=stb
  157. drawbutton(stb)
  158. gpu.set(3,5, "Суть игры: выбить 3 одинаковых числа")
  159.  
  160. local _,_,x,y,_,name = event.pull("touch")
  161.  
  162.  
  163. if x>=2 and y>=3 and x<=12 and y<=6 then
  164. stb[6]=0xFF0000
  165. drawbutton(stb)
  166. term.setCursor(1,2)
  167. comp.beep()
  168. term.write("Игрок: ".. name)
  169. os.sleep(1)
  170. ch=gpu.setBackground(0xFFFFFF)
  171. term.setCursor(8,14)
  172. term.write(" ")
  173. term.setCursor(w/2,14)
  174. term.write(" ")
  175. term.setCursor(w-8,14)
  176. term.write(" ")
  177. gpu.setBackground(0x000000)
  178. clearB()
  179. game()
  180. end
  181. end
  182.  
  183. while d==0 do
  184. main()
  185. gpu.set(10, 1, "Побед: ".. wins .." Проигрышей: ".. loses)
  186. semerka(w/2,13)
  187. semerka(w/2-10,13)
  188. semerka(w/2+10,13)
  189. clicker()
  190. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement