Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local os = require("os")
- print("Made by GameDoctor")
- print("Запуск программы...")
- os.sleep(2)
- local comp = require("computer")
- local co = require("component")
- local term = require("term")
- local gpu = co.gpu
- gpu.setResolution(40,20)
- local w, h = gpu.getResolution()
- local event = require("event")
- local d = 0
- local wins = 0
- local loses = 0
- function main()
- gpu.setResolution(40,20)
- term.clear()
- a=gpu.setBackground(0x008000)
- term.clear()
- gpu.setBackground(0x000000)
- b=gpu.setForeground(0x00FF00)
- gpu.fill(1,1,w,2," ")
- gpu.setBackground(0xFFFFFF)
- gpu.fill(5,8,31,12," ")
- gpu.setBackground(0xFFFFFF)
- gpu.setForeground(0xFF0000)
- term.setCursor(8,14)
- term.write(" ")
- term.setCursor(w/2,14)
- term.write(" ")
- term.setCursor(w-8,14)
- term.write(" ")
- gpu.setForeground(0x000000)
- gpu.fill(14,8,1,12,"|")
- gpu.fill(w-14,8,1,12,"|")
- gpu.setForeground(0x00FF00)
- gpu.setBackground(0x000000)
- end
- function semerka(x,y)
- kekosi = gpu.setBackground(0xFF0000)
- kekchi = gpu.setForeground(0xFF0000)
- gpu.set(x-2,y-1," ")
- gpu.set(x-1,y-1," ")
- gpu.set(x,y-1," ")
- gpu.set(x,y," ")
- gpu.set(x-1,y+1," ")
- gpu.set(x-1,y+2," ")
- gpu.setBackground(kekosi)
- gpu.setForeground(kekchi)
- end
- function game()
- for i=1,2 do
- gpu.setBackground(0x000000)
- gpu.fill(6,12,1,2," ")
- gpu.fill(10,12,1,2," ")
- gpu.fill(8,14,1,2," ")
- gpu.fill(18,12,1,2," ")
- gpu.fill(22,12,1,2," ")
- gpu.fill(20,14,1,2," ")
- gpu.fill(w-6,12,1,2," ")
- gpu.fill(w-10,12,1,2," ")
- gpu.fill(w-8,14,1,2," ")
- os.sleep(0.4)
- gpu.setBackground(0xFFFFFF)
- gpu.fill(6,12,1,2," ")
- gpu.fill(10,12,1,2," ")
- gpu.fill(8,14,1,2," ")
- gpu.fill(18,12,1,2," ")
- gpu.fill(22,12,1,2," ")
- gpu.fill(20,14,1,2," ")
- gpu.fill(w-6,12,1,2," ")
- gpu.fill(w-10,12,1,2," ")
- gpu.fill(w-8,14,1,2," ")
- os.sleep(0.5)
- gpu.setBackground(0x000000)
- gpu.fill(6,14,1,2," ")
- gpu.fill(10,14,1,2," ")
- gpu.fill(8,12,1,2," ")
- gpu.fill(18,14,1,2," ")
- gpu.fill(22,14,1,2," ")
- gpu.fill(20,12,1,2," ")
- gpu.fill(w-6,14,1,2," ")
- gpu.fill(w-10,14,1,2," ")
- gpu.fill(w-8,12,1,2," ")
- gpu.setBackground(0xFFFFFF)
- os.sleep(0.5)
- gpu.fill(6,14,1,2," ")
- gpu.fill(10,14,1,2," ")
- gpu.fill(8,12,1,2," ")
- gpu.fill((w/2)-2,14,1,2," ")
- gpu.fill((w/2)+2,14,1,2," ")
- gpu.fill(w/2,12,1,3," ")
- gpu.fill(w-6,14,1,2," ")
- gpu.fill(w-10,14,1,2," ")
- gpu.fill(w-8,12,1,2," ")
- os.sleep(0.5)
- end
- gpu.setBackground(0x000000)
- local na = math.random(1,2)
- local nb = math.random(1,2)
- local nc = math.random(1,2)
- term.setCursor(8,15)
- term.write(math.floor(na))
- term.setCursor(w/2,15)
- term.write(math.floor(nb))
- term.setCursor(w-8,15)
- term.write(math.floor(nc))
- os.sleep(2)
- if na == nb and nb == nc then
- gpu.fill(5,8,31,12," ")
- term.setCursor((w/2)-5,h/2)
- term.write("ВЫ ВЫИГРАЛИ :)")
- wins = wins + 1
- local red = co.redstone
- red.setOutput(1, 15)
- red.setOutput(1, 0)
- os.sleep(3)
- else
- gpu.fill(5,8,31,12," ")
- term.setCursor((w/2)-5,h/2)
- term.write("ВЫ ПРОИГРАЛИ :(")
- loses = loses + 1
- os.sleep(2)
- end
- end
- function clearB()
- asl=gpu.setForeground(0xFFFFFF)
- gpu.setBackground(0xFFFFFF)
- gpu.fill(5,8,31,12," ")
- gpu.setForeground(0x000000)
- gpu.fill(14,8,1,12,"|")
- gpu.fill(w-14,8,1,12,"|")
- gpu.setForeground(asl)
- end
- function drawbutton(bID)
- cy=gpu.setBackground(bID[6])
- gpu.fill(bID[2],bID[3],bID[4],bID[5]," ")
- term.setCursor(bID[2],bID[3]+bID[5]/2)
- acy=gpu.setForeground(0x000000)
- term.write(bID[1])
- gpu.setBackground(cy)
- gpu.setForeground(acy)
- end
- function clicker()
- local stb={"СТАРТ",2,3,5,1,0xDAA520,clicked,output}
- local stb1=stb
- drawbutton(stb)
- gpu.set(3,5, "Суть игры: выбить 3 одинаковых числа")
- local _,_,x,y,_,name = event.pull("touch")
- if x>=2 and y>=3 and x<=12 and y<=6 then
- stb[6]=0xFF0000
- drawbutton(stb)
- term.setCursor(1,2)
- comp.beep()
- term.write("Игрок: ".. name)
- os.sleep(1)
- ch=gpu.setBackground(0xFFFFFF)
- term.setCursor(8,14)
- term.write(" ")
- term.setCursor(w/2,14)
- term.write(" ")
- term.setCursor(w-8,14)
- term.write(" ")
- gpu.setBackground(0x000000)
- clearB()
- game()
- end
- end
- while d==0 do
- main()
- gpu.set(10, 1, "Побед: ".. wins .." Проигрышей: ".. loses)
- semerka(w/2,13)
- semerka(w/2-10,13)
- semerka(w/2+10,13)
- clicker()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement