timur77
Junior Member
Someday I will tell my grandsons that I am older than the Internet. And it will blow their brain.
Posts: 79
|
Post by timur77 on Apr 1, 2020 4:25:25 GMT -5
Here is the link to the game " Minesweeper" Here is the code 'Сапер nomainwin d=DisplayWidth sh=DisplayHeight WindowWidth = 540 WindowHeight = 500 UpperLeftX=d/2-WindowWidth/2 UpperLeftY=sh/2-WindowHeight/2
dim p(40,40)
loadbmp "b0", "bmp\0.bmp" loadbmp "b1", "bmp\1.bmp" loadbmp "b2", "bmp\2.bmp" loadbmp "b3", "bmp\3.bmp" loadbmp "b4", "bmp\4.bmp" loadbmp "b5", "bmp\5.bmp" loadbmp "b6", "bmp\6.bmp" loadbmp "b7", "bmp\7.bmp" loadbmp "b8", "bmp\8.bmp" loadbmp "b9", "bmp\9.bmp" loadbmp "b10", "bmp\10.bmp" loadbmp "b11", "bmp\11.bmp" loadbmp "b12", "bmp\12.bmp" loadbmp "b13", "bmp\13.bmp" loadbmp "b14", "bmp\14.bmp"
button #win.b "Заново",[restart],UL,420,10,100,30 statictext #win.st1, "", 420, 50, 120, 30 statictext #win.st2, "", 420, 90, 110, 60 statictext #win.st3, "", 420, 150, 110, 60 graphicbox #win.gb, 10,10,402,402 open "Сапер" for window_nf as #win #win.gb, "when leftButtonDown [check]" #win.gb, "when rightButtonDown [mark]" #win, "trapclose [exit]" #win.b "!font Courier_New Bold 14" #win.st1 "!font Arial_Narrow Bold 12" #win.st2 "!font Arial_Narrow Bold 10" #win.st3 "!font Century_Gothic 10"
[restart] #win.gb, "cls" time1=time$("ms") timer 1000, [timer] mm=0 m1=0 m2=0 for i=1 to 20 for a=1 to 20 p(i,a)=int(rnd(1)*1.2)*9 if p(i,a)=9 then mm=mm+1 next a next i #win.st1, "Осталось мин:";mm for i=1 to 20 for a=1 to 20 s=0 if p(i,a)=0 then if p(i+1,a)=9 Then s=s+1 if p(i+1,a+1)=9 Then s=s+1 if p(i,a+1)=9 Then s=s+1 if p(i-1,a+1)=9 Then s=s+1 if p(i-1,a)=9 Then s=s+1 if p(i-1,a-1)=9 Then s=s+1 if p(i,a-1)=9 Then s=s+1 if p(i+1,a-1)=9 Then s=s+1 p(i,a)=s end if next a next i
for i=1 to 20 for a=1 to 20 #win.gb, "drawbmp b9 ";i*20-20;" ";a*20-20 next a next i #win.gb, "flush" #win.gb, "redraw" wait
[mark] x=MouseX y=MouseY dx=int(MouseX/20)+1 dy=int(MouseY/20)+1
if p(dx,dy)=29 then p(dx,dy)=9: #win.gb, "drawbmp b9 ";dx*20-20;" ";dy*20-20:#win.gb, "flush":m2=m2-1:wait if p(dx,dy)>29 then p(dx,dy)=p(dx,dy)-30: #win.gb, "drawbmp b9 ";dx*20-20;" ";dy*20-20:#win.gb, "flush":wait if p(dx,dy)<10 then #win.gb, "drawbmp b11 ";dx*20-20;" ";dy*20-20:m1=m1+1:#win.st1, "Осталось мин:";mm-m1 if p(dx,dy)=9 then p(dx,dy)=29 m2=m2+1 if m2=mm and m1=mm then notice "Победа!!!"+chr$(13)+"Вы нашли ";mm;" мин за ";time2;" секунд!":goto [win] else if p(dx,dy)>0 And p(dx,dy)<9 then p(dx,dy)=p(dx,dy)+30 end if #win.gb, "flush" wait
[check] x=MouseX y=MouseY dx=int(MouseX/20)+1 dy=int(MouseY/20)+1 if p(dx,dy)=9 then goto [bum] if p(dx,dy)=0 then p(dx,dy)=p(dx,dy)+10:goto [open] if p(dx,dy)=1 then p(dx,dy)=p(dx,dy)+20: #win.gb, "drawbmp b1 ";dx*20-20;" ";dy*20-20 if p(dx,dy)=2 then p(dx,dy)=p(dx,dy)+20: #win.gb, "drawbmp b2 ";dx*20-20;" ";dy*20-20 if p(dx,dy)=3 then p(dx,dy)=p(dx,dy)+20: #win.gb, "drawbmp b3 ";dx*20-20;" ";dy*20-20 if p(dx,dy)=4 then p(dx,dy)=p(dx,dy)+20: #win.gb, "drawbmp b4 ";dx*20-20;" ";dy*20-20 if p(dx,dy)=5 then p(dx,dy)=p(dx,dy)+20: #win.gb, "drawbmp b5 ";dx*20-20;" ";dy*20-20 if p(dx,dy)=6 then p(dx,dy)=p(dx,dy)+20: #win.gb, "drawbmp b6 ";dx*20-20;" ";dy*20-20 if p(dx,dy)=7 then p(dx,dy)=p(dx,dy)+20: #win.gb, "drawbmp b7 ";dx*20-20;" ";dy*20-20 if p(dx,dy)=8 then p(dx,dy)=p(dx,dy)+20: #win.gb, "drawbmp b8 ";dx*20-20;" ";dy*20-20 #win.gb, "flush" wait
[open] f=0 for i=1 to 20 for a=1 to 20 if p(i,a)=10 then #win.gb, "drawbmp b"+trim$(str$(p(i,a)-10))+" ";i*20-20;" ";a*20-20 p(i,a)=p(i,a)+10 f=1 if p(i+1,a)<9 Then #win.gb, "drawbmp b"+trim$(str$(p(i+1,a)))+" ";(i+1)*20-20;" ";a*20-20 if p(i+1,a)=0 then p(i+1,a)=p(i+1,a)+10 else p(i+1,a)=p(i+1,a)+20 f=1 end if if p(i+1,a+1)<9 Then #win.gb, "drawbmp b"+trim$(str$(p(i+1,a+1)))+" ";(i+1)*20-20;" ";(a+1)*20-20 if p(i+1,a+1)=0 then p(i+1,a+1)=p(i+1,a+1)+10 else p(i+1,a+1)=p(i+1,a+1)+20 f=1 end if if p(i,a+1)<9 Then #win.gb, "drawbmp b"+trim$(str$(p(i,a+1)))+" ";i*20-20;" ";(a+1)*20-20 if p(i,a+1)=0 then p(i,a+1)=p(i,a+1)+10 else p(i,a+1)=p(i,a+1)+20 f=1 end if if p(i-1,a+1)<9 Then #win.gb, "drawbmp b"+trim$(str$(p(i-1,a+1)))+" ";(i-1)*20-20;" ";(a+1)*20-20 if p(i-1,a+1)=0 then p(i-1,a+1)=p(i-1,a+1)+10 else p(i-1,a+1)=p(i-1,a+1)+20 f=1 end if if p(i-1,a)<9 Then #win.gb, "drawbmp b"+trim$(str$(p(i-1,a)))+" ";(i-1)*20-20;" ";a*20-20 if p(i-1,a)=0 then p(i-1,a)=p(i-1,a)+10 else p(i-1,a)=p(i-1,a)+20 f=1 end if if p(i-1,a-1)<9 Then #win.gb, "drawbmp b"+trim$(str$(p(i-1,a-1)))+" ";(i-1)*20-20;" ";(a-1)*20-20 if p(i-1,a-1)=0 then p(i-1,a-1)=p(i-1,a-1)+10 else p(i-1,a-1)=p(i-1,a-1)+20 f=1 end if if p(i,a-1)<9 Then #win.gb, "drawbmp b"+trim$(str$(p(i,a-1)))+" ";i*20-20;" ";(a-1)*20-20 if p(i,a-1)=0 then p(i,a-1)=p(i,a-1)+10 else p(i,a-1)=p(i,a-1)+20 f=1 end if if p(i+1,a-1)<9 Then #win.gb, "drawbmp b"+trim$(str$(p(i+1,a-1)))+" ";(i+1)*20-20;" ";(a-1)*20-20 if p(i+1,a-1)=0 then p(i+1,a-1)=p(i+1,a-1)+10 else p(i+1,a-1)=p(i+1,a-1)+20 f=1 end if end if next a next i if f=1 then goto [open] #win.gb, "flush" wait
[bum] p(dx,dy)=12 #win.gb, "drawbmp b13 ";dx*20-20;" ";dy*20-20 for i=1 to 20 for a=1 to 20 if p(i,a)=9 then p(i,a)=12: #win.gb, "drawbmp b12 ";i*20-20;" ";a*20-20 if p(i,a)<9 then p(i,a)=p(i,a)+20 if p(i,a)>29 and p(i,a)<39 then #win.gb, "drawbmp b14 ";i*20-20;" ";a*20-20 next a next i #win.gb, "flush" 'wait
[win] #win.st3, "Счет:";int(m2+m2*100/(time2+1)) confirm "Хотите сыграть еще раз?";ans$ if ans$="yes" or ans$="да" then goto [restart]
[exit] close #win end
[timer] time2=int((time$("ms")-time1)/1000) #win.st2, "Прошло времени: "+" ";time2;" секунд" #win.st3, "Счет:";int(m1+m1*100/(time2+1)) wait
|
|