Uses Crt,dos,graph; Const fx=40; fy=10; Var x : array[0..2000] of byte; y : array[0..2000] of byte; xb,c,e,s,yb,xx,xy,xe,ye : byte; e1,e2,e3,e4 : word; ch : char; l,i,right,top : 0..2000; dr,f,mo,speed,s1,score,t,n : integer; otv : string[3]; Procedure SetCursorSize( c_Start, c_End : Byte ); { 0 .. 32 Устанавливает форму курсора} var Regs : Registers; BEGIN with Regs do begin AH := $01; {функция формы курсора} CH := c_Start; {стартовая линия курсора} CL := c_End; {конечная линия курсора} end; Intr( $10, Regs ) {вызов прерывания 10H БСВВ} End; Procedure SetNoCursor; {Невидимый курсора} BEGIN SetCursorSize( 32, 0 ) END; begin ClrScr; s1:=0; t:=0; n:=0; dr:=detect; initgraph(dr,mo,'bgi'); SetColor(0); SetBkColor(0); SetFillStyle(4,9); repeat s1:=s1+5; t:=t+5; n:=n+1; c:=random(15); Setcolor(c); Rectangle(s1,t,getmaxx-s1,getmaxy-t); delay(50); until(n=5); SetColor(15); Bar(50,90,GetMaxX-50,300); MoveTo(80,GetMaxY div 3); SetTextStyle(1,0,5); OutText('Worms, Worms, Worms'); SettextStyle(0,0,2); OutTextXY(getmaxx div 3 ,getmaxy div 2,'Начнем !!!'); readLn; SetColor(0); SetBkColor(0); CloseGraph; ClrScr; SetNoCursor; GotoXy(15,5); Write('Введите скорость от 1-20 (чем больше ,тем медленнее): '); ReadLn(speed); if speed > 20 then begin GoToXY(20,6); Write('Скорость слишком маленькая, введите еще раз: '); Read(speed); end; ClrScr; TextColor(9); Write(chr(201)); GotoXy(50,1); Write(chr(187)); for top:=2 to 49 do begin GotoXY(top,1); write(chr(205)); end; for right:=2 to 24 do begin GotoXy(1,right); Write(chr(186)); GotoXy(50,right); Write(chr(186)); end; GotoXY(1,24); Write(chr(200)); GotoXY(50,24); Write(chr(188)); for top:=2 to 49 do begin GotoXy(top,24); Write(chr(205)); end; { for i:=0 to 2000 do begin x[i]:=0; y[i]:=0; end;} x[1]:=35; y[1]:=10; Randomize; repeat c:=random(16); TextColor(c); Gotoxy(Random(79),random(24)); xx:=WhereX; xy:=WhereY; Until(xx<>x[1]) and (xy<>x[1]) and (c<>0) and (xx>1) and (xy>1) and (xx<49) and (xy<24); Write('X'); xb:=x[1]; xe:=x[1]; yb:=y[1]; ye:=y[1]; l:=1; score:=0; GotoXY(xb,yb); Write('['); GotoXY(51,2); Write('Длина червя = ',l); GotoXY(51,4); Write('Скорость червя = ',speed); GoToXY(51,6); Write('Кол-во очков = ',score); repeat ch:=readkey; ch:=readkey; if ch =#77 then begin repeat if e=2 then begin sound(150); delay(1000); Nosound; Exit; end; e:=1; xb:=x[1]+1; if xb=50 then begin sound(150); delay(1000); Nosound; Exit; end; if not((xb-1=xx) and (yb=xy)) then begin Gotoxy(xe,ye); Write(' '); end else begin l:=l+1; f:=l; score:=score+5; GotoXY(51,2); Write('Длина червя = ',l); if f in [10,20,30,40,50,60,70,80,90,100,110,120,130,140,150,160,170,180,190,200] then speed:=Speed+1; {(l=10) or (l=20) or (l=30) or (l=40) or (l=50) or (l=60) or (l=70) or (l=80)} if speed=21 then begin ClrScr; Gotoxy(40,12); Write('ВЫ ВЫИГРАЛИ'); end; GotoXY(51,4); Write('Скорость червя = ',speed); GoToXY(51,6); Write('Кол-во очков = ',score); repeat c:=random(16); TextColor(c); Gotoxy(Random(80),random(25)); xx:=WhereX; xy:=WhereY; Until(xx<>x[1]) and (xy<>y[1]) and (c<>0) and (xx>1) and (xy>1) and (xx<49) and (xy<24); Write('X'); end; repeat c:=random(15); TextColor(c); until(c<>0); Gotoxy(xb,yb); Write ('O'); delay(1000+round(1/speed*220)); For i:=l downto 1 do begin x[i]:=x[i-1];y[i]:=y[i-1]; end; x[1]:=xb;y[1]:=yb; xe:=x[l];ye:=y[l]; for i:=2 to l do if (xb = x[i]) and (yb = y[i]) then Exit; until(keypressed); end; if ch =#75 then begin repeat xb:=x[1]-1; if e=1 then begin sound(150); delay(1000); Nosound; Exit; end; e:=2; if xb=1 then begin sound(150); delay(1000); Nosound; Exit; end; if not((xb+1=xx) and (yb=xy)) then begin Gotoxy(xe,ye); Write(' '); end else begin l:=l+1; f:=l; score:=score+5; GotoXY(51,2); Write('Длина червя = ',l); if f in [10,20,30,40,50,60,70,80,90,100,110,120,130,140,150,160,170,180,190,200] {(l=10) or (l=20) or (l=30) or (l=40) or (l=50) or (l=60) or (l=70) or (l=80)} then speed:=Speed+1; if speed=21 then begin ClrScr; Gotoxy(40,12); Write('ВЫ ВЫИГРАЛИ'); end; GotoXY(51,4); Write('Скорость червя = ',speed); GoToXY(51,6); Write('Кол-во очков = ',score); repeat c:=random(16); TextColor(c); Gotoxy(Random(80),random(25)); xx:=WhereX; xy:=WhereY; Until(xx<>x[1]) and (xy<>x[1]) and (c<>0) and (xx>1) and (xy>1) and (xx<49) and (xy<24); Write('X'); end; repeat c:=random(15); TextColor(c); until(c<>0); Gotoxy(xb,yb); Write ('O'); delay(1000+round(1/speed*220)); For i:=l downto 1 do begin x[i]:=x[i-1]; y[i]:=y[i-1]; end; x[1]:=xb; y[1]:=yb; xe:=x[l]; ye:=y[l]; for i:=2 to l do if (xb = x[i]) and (yb = y[i]) then Exit; until(keypressed); end; if ch =#80 then begin if e = 4 then begin sound(150); delay(1000); Nosound; Exit; end; e:=3; repeat yb:=y[1]+1; if yb=24 then begin sound(150); delay(1000); Nosound; Exit; end; if not((xb=xx) and (yb-1=xy)) then begin Gotoxy(xe,ye); Write(' '); end else begin l:=l+1; f:=l; score:=score+5; GotoXY(51,2); Write('Длина червя = ',l); if f in [10,20,30,40,50,60,70,80,90,100,110,120,130,140,150,160,170,180,190,200] {(l=10) or (l=20) or (l=30) or (l=40) or (l=50) or (l=60) or (l=70) or (l=80)} then speed:=Speed+1; if speed=21 then begin ClrScr; Gotoxy(40,12); Write('ВЫ ВЫИГРАЛИ'); end; GotoXY(51,4); Write('Скорость червя = ',speed); GoToXY(51,6); Write('Кол-во очков = ',score); repeat c:=random(16); TextColor(c); Gotoxy(Random(80),random(25)); xx:=WhereX; xy:=WhereY; Until(xx<>x[1]) and (xy<>x[1]) and (c<>0) and (xx>1) and (xy>1) and (xx<49) and (xy<24); Write('X'); end; repeat c:=random(15); TextColor(c); until(c<>0); Gotoxy(xb,yb); Write ('O'); delay(1000+round(1/speed*220)); For i:=l downto 1 do begin x[i]:=x[i-1];y[i]:=y[i-1];end; x[1]:=xb;y[1]:=yb; xe:=x[l];ye:=y[l]; y[1]:=yb; for i:=2 to l do if (xb = x[i]) and (yb = y[i]) then Exit; until(keypressed); end; if ch =#72 then begin if e = 3 then begin sound(150); delay(1000); Nosound; Exit; end; repeat e:=4; yb:=y[1]-1; if yb=1 then begin sound(150); delay(2000); Nosound; Exit; end; if not((xb=xx) and (yb+1=xy)) then begin Gotoxy(xe,ye); Write(' '); end else begin l:=l+1; score:=score+5; GotoXY(51,2); Write('Длина червя = ',l); if f in [10,20,30,40,50,60,70,80,90,100,110,120,130,140,150,160,170,180,190,200] {(l=10) or (l=20) or (l=30) or (l=40) or (l=50) or (l=60) or (l=70) or (l=80)} then speed:=Speed+1; if speed=21 then begin ClrScr; Gotoxy(40,12); Write('ВЫ ВЫИГРАЛИ'); end; GotoXY(51,4); Write('Скорость червя = ',speed); GoToXY(51,6); Write('Кол-во очков = ',score); repeat c:=random(16); TextColor(c); Gotoxy(Random(80),random(25)); xx:=WhereX; xy:=WhereY; Until(xx<>x[1]) and (xy<>x[1]) and (c<>0) and (xx>1) and (xy>1) and (xx<49) and (xy<24); Write('X'); end; repeat c:=random(15); TextColor(c); until(c<>0); Gotoxy(xb,yb); Write ('O'); delay(1000+round(1/speed*220)); For i:=l downto 1 do begin x[i]:=x[i-1];y[i]:=y[i-1];end; x[1]:=xb;y[1]:=yb; xe:=x[l];ye:=y[l]; y[1]:=yb; for i:=2 to l do if (xb = x[i]) and (yb = y[i]) then Exit; until(keypressed); end; until(ch=#3); end.