Гость

|
Вот сама программа:
program ERIK; uses crt, graph;
const d1000=1000; d500=50;
var a, ba, bo, bd, c, i, t, pilote, mode, size, ph, od, oh, s1, s2, n, t2, t3: integer; son: boolean; palet, balle, blank: pointer; s: string;
begin pilote:=detect; initGraph(pilote,mode,'c:\tp\bgi'); clearviewport;
size:=imagesize(50,50,60,60); new(blank); getmem(blank,size); getimage(50,50,60,60,blank^);
setcolor(14); rectangle(5,5,20,65); setfillstyle(1,1); floodfill(10,10,14);
size:=imagesize(4,3,21,67); new(palet); getmem(palet,size); getimage(4,3,21,67,palet^);
setcolor(10); circle(55,55,3); setfillstyle(1,10); floodfill(55,55,10);
size:=imagesize(50,50,60,60); new(balle); getmem(balle,size); getimage(50,50,60,60,balle^);
clearviewport; setcolor(5); setbkcolor(0); rectangle(1,478,638,479); rectangle(1,20,638,21);
ba:=30; bo:=random(200)+100; bd:=3+6*random(2);
t:=0; ph:=100; oh:=300; putimage(5,ph,palet^,normalput); putimage(615,oh,palet^,normalput);
s1:=0; s2:=0; son:=true; repeat outtextxy(250,250,'Level? (1-6)'); repeat until keypressed; n:=ord(readkey)-ord('0'); until (n<7)and(n>0);
outtextxy(15,5,'level:'); str(n,s); outtextxy(75,5,s); setcolor(0); outtextxy(250,250,'Level? (1-6)');
repeat case bd of 1: begin ba:=ba-1-n div 4; bo:=bo+1+n div 4; end; 3: begin ba:=ba+1+n div 4; bo:=bo+1+n div 4; end; 7: begin ba:=ba-1-n div 4; bo:=bo-1-n div 4; end; 9: begin ba:=ba+1+n div 4; bo:=bo-1-n div 4; end; end;
putimage(ba,bo,balle^,normalput);
if ba<5 then begin putimage(4,bo,blank^,normalput); s2:=s2+1; if son=true then begin sound(200); delay(d1000); nosound; end; ba:=590; bo:=100+random(200); bd:=1+6*random(2); setcolor(4); settextstyle(8,0,10); str(s1,s); outtextxy(150,140,s); outtextxy(300,140,'-'); str(s2,s); outtextxy(450,140,s); delay(d1000); setcolor(0); str(s1,s); outtextxy(150,140,s); outtextxy(300,140,'-'); str(s2,s); outtextxy(450,140,s); if s2=10 then begin setcolor(4); settextstyle(8,0,4); outtextxy(180,200,'Player 2 Wins'); if son=true then begin for i:=1 to 3 do begin sound(2000); delay(d1000); nosound; delay(d500); end; sound(2000); delay(d1000); nosound; end; repeat until keypressed; halt; end; end;
if ba>625 then begin putimage(625,bo,blank^,normalput); s1:=s1+1; if son=true then begin sound(200); delay(d1000); nosound; end; ba:=30; bo:=random(200)+100; bd:=3+6*random(2); setcolor(4); settextstyle(8,0,10); str(s1,s); outtextxy(150,140,s); outtextxy(300,140,'-'); str(s2,s); outtextxy(450,140,s); delay(d1000); setcolor(0); str(s1,s); outtextxy(150,140,s); outtextxy(300,140,'-'); str(s2,s); outtextxy(450,140,s); if s1=10 then begin setcolor(4); settextstyle(8,0,4); outtextxy(180,200,'Player 1 wins'); if son=true then begin for i:=1 to 3 do begin sound(2000); delay(d1000); nosound; delay(d500); end; sound(2000); delay(d1000); nosound; end; repeat until keypressed; halt; end;
end;
if (n=1)or(n=4) then delay(20); if (n=2)or(n=5) then delay(10);
if (ba<20)and(bo>ph)and(bo<ph+45) then begin ba:=27; bd:=3+6*random(2); end; if (ba>616)and(bo>oh)and(bo<oh+45) then begin ba:=610; bd:=1+6*random(2); end;
c:=getpixel(ba+5,bo-2); if (c=5)or(c=14)or(c=1) then if bd=9 then bd:=3 else bd:=1; c:=getpixel(ba+11,bo+5); if (c=14)or(c=1) then if bd=9 then bd:=7 else bd:=1; c:=getpixel(ba-2,bo+5); if (c=5)or(c=1) then if bd=7 then bd:=9 else bd:=3; c:=getpixel(ba+5,bo+12); if (c=5)or(c=14)or(c=1) then if bd=3 then bd:=9 else bd:=7;
if keypressed then t:=ord(readkey)-ord('0'); if (t>0)and(t<4) then t3:=t else t2:=t; if (t2=ord('w')-ord('0'))and(ph<412) then ph:=ph+1+ n div 4; if (t2=ord('c')-ord('0'))and(ph>22) then ph:=ph-1- n div 4;
if (t3=3)and(oh>22) then oh:=oh-1- n div 4; if (t3=1)and(oh<412) then oh:=oh+1+n div 4; if t=ord('p')-ord('0') then repeat until keypressed; if t=ord('s')-ord('0') then son:=(son=false);
putimage(5,ph,palet^, normalput); putimage(615,oh,palet^, normalput);
until t=ord('q')-ord('0');
closegraph;
dispose(palet); dispose(balle); dispose(blank);
end.
|