Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so just use oauth login instead. :)
Paste
Pasted by kenny ( 15 years ago )
program fff;
Uses
crt,graph;
const
d=50;
type
MWays=array[1..3] of integer;
MFlags=array[1..4] of boolean;
Engine=record
AddX:integer;
AddX2:integer;
AddY:integer;
AddY2:integer;
NCircle:shortint;
FStop:boolean;
F:Mflags;
end;
MPeople=array[1..3] of Engine;
var
Driver,Mode,Error,a,b,x1,x2,y1,y2,c,e,i,j,temp:integer;
Flag1,Flag2:boolean;
n,nn:byte;
s:MWays;
Info:MPeople;
key:char;
MaxV:Mways;
procedure CheckResolution(var a,b:integer);
Begin
a:=GetMaxX;
b:=GetMaxY;
end;
function DetWay(var x1,x2,y1,y2,i:integer):integer;
Begin
DetWay:=((x2-x1-2*i*d)+(y2-y1-2*i*d))*2;
end;
procedure DrawRectangle(var a,b,x1,x2,y1,y2:integer);
var
i:byte;
Begin
x1:=a div 150;
y1:=b div 149;
x2:=x1*149;
y2:=y1*148;
for i:=0 to 3 do
Rectangle(x1+i*d,y1+i*d,x2-i*d,y2-i*d);
end;
procedure DrawPeople0(var x1,y1,c:integer);
Begin
Circle(x1+125,y1+5+c,5);
Line(x1+125,y1+10+c,x1+125,y1+25+c); {tulovishe}
Line(x1+125,y1+10+c,x1+135,y1+25+c); {pravaya ruka}
Line(x1+125,y1+10+c,x1+115,y1+25+c); {levaya ruka}
Line(x1+125,y1+25+c,x1+135,y1+50+c); {pravaya noga}
Line(x1+125,y1+25+c,x1+115,y1+50+c); {levaya noga}
End;
procedure DrawPeople1(var x1,y1,c,e:integer);
Begin
Circle(x1+125+c,y1+5+e,5);
Line(x1+125+c,y1+10+e,x1+120+c,y1+30+e); {tulovishe}
Line(x1+125+c,y1+10+e,x1+130+c,y1+20+e); {pravaya ruka}
Line(x1+130+c,y1+20+e,x1+140+c,y1+15+e);
Line(x1+125+c,y1+10+e,x1+115+c,y1+15+e); {levaya ruka}
Line(x1+115+c,y1+15+e,x1+117+c,y1+23+e);
Line(x1+120+c,y1+30+e,x1+135+c,y1+35+e); {pravaya noga}
Line(x1+135+c,y1+35+e,x1+130+c,y1+45+e);
Line(x1+130+c,y1+45+e,x1+135+c,y1+47+e);
Line(x1+120+c,y1+30+e,x1+113+c,y1+40+e); {levaya noga}
Line(x1+113+c,y1+40+e,x1+103+c,y1+33+e);
Line(x1+103+c,y1+33+e,x1+100+c,y1+39+e);
end;
procedure DrawPeople2(var x1,y1,c,e:integer);
Begin
Circle(x1+125+c,y1+5+e,5);
Line(x1+125+c,y1+10+e,x1+120+c,y1+30+e); {tulovishe}
Line(x1+125+c,y1+10+e,x1+124+c,y1+24+e); {pravaya ruka}
Line(x1+124+c,y1+24+e,x1+133+c,y1+21+e);
Line(x1+125+c,y1+10+e,x1+118+c,y1+20+e); {levaya ruka}
Line(x1+118+c,y1+20+e,x1+124+c,y1+24+e);
Line(x1+120+c,y1+30+e,x1+125+c,y1+38+e); {pravaya noga}
Line(x1+125+c,y1+38+e,x1+120+c,y1+46+e);
Line(x1+120+c,y1+46+e,x1+124+c,y1+50+e);
Line(x1+120+c,y1+30+e,x1+120+c,y1+40+e); {levaya noga}
Line(x1+120+c,y1+40+e,x1+115+c,y1+47+e);
Line(x1+115+c,y1+47+e,x1+118+c,y1+50+e);
end;
procedure DrawPeople3(var x2,y1,c,e:integer);
Begin
Circle(x2-25-c,y1+5+e+c,5);
Line(x2-25-c,y1+10+e+c,x2-25-c,y1+25+e+c); {tulovishe}
Line(x2-25-c,y1+10+e+c,x2-15-c,y1+25+e+c); {pravaya ruka}
Line(x2-25-c,y1+10+e+c,x2-35-c,y1+25+e+c); {levaya ruka}
Line(x2-25-c,y1+25+e+c,x2-20-c,y1+40+e+c); {pravaya noga}
Line(x2-20-c,y1+40+e+c,x2-20-c,y1+30+e+c);
Line(x2-25-c,y1+25+e+c,x2-30-c,y1+40+e+c); {levaya noga}
Line(x2-30-c,y1+40+e+c,x2-30-c,y1+50+e+c);
End;
procedure DrawPeople4(var x2,y1,c,e:integer);
Begin
Circle(x2-25-c,y1+5+e+c,5);
Line(x2-25-c,y1+10+e+c,x2-25-c,y1+25+e+c); {tulovishe}
Line(x2-25-c,y1+10+e+c,x2-15-c,y1+25+e+c); {pravaya ruka}
Line(x2-25-c,y1+10+e+c,x2-35-c,y1+25+e+c); {levaya ruka}
Line(x2-25-c,y1+25+e+c,x2-20-c,y1+40+e+c); {pravaya noga}
Line(x2-20-c,y1+40+e+c,x2-20-c,y1+50+e+c);
Line(x2-25-c,y1+25+e+c,x2-30-c,y1+40+e+c); {levaya noga}
Line(x2-30-c,y1+40+e+c,x2-30-c,y1+30+e+c);
End;
procedure DrawPeople5(var x2,y2,c,e:integer);
Begin
Circle(x2-25-c-e,y2-45-e,5);
Line(x2-25-c-e,y2-40-e,x2-20-c-e,y2-20-e); {tulovishe}
Line(x2-25-c-e,y2-40-e,x2-15-c-e,y2-35-e); {pravaya ruka}
Line(x2-15-c-e,y2-35-e,x2-18-c-e,y2-27-e);
Line(x2-25-c-e,y2-40-e,x2-30-c-e,y2-30-e); {levaya ruka}
Line(x2-30-c-e,y2-30-e,x2-36-c-e,y2-32-e);
Line(x2-20-c-e,y2-20-e,x2-12-c-e,y2-10-e); {pravaya noga}
Line(x2-12-c-e,y2-10-e,x2-3-c-e,y2-13-e);
Line(x2-3-c-e,y2-13-e,x2-c-e,y2-10-e);
Line(x2-20-c-e,y2-20-e,x2-33-c-e,y2-13-e); {levaya noga}
Line(x2-33-c-e,y2-13-e,x2-30-c-e,y2-3-e);
Line(x2-30-c-e,y2-3-e,x2-35-c-e,y2-e);
end;
procedure DrawPeople6(var x2,y2,c,e:integer);
Begin
Circle(x2-25-c-e,y2-45-e,5);
Line(x2-25-c-e,y2-40-e,x2-20-c-e,y2-20-e); {tulovishe}
Line(x2-25-c-e,y2-40-e,x2-18-c-e,y2-29-e); {pravaya ruka}
Line(x2-18-c-e,y2-29-e,x2-22-c-e,y2-28-e);
Line(x2-25-c-e,y2-40-e,x2-27-c-e,y2-28-e); {levaya ruka}
Line(x2-27-c-e,y2-28-e,x2-32-c-e,y2-32-e);
Line(x2-20-c-e,y2-20-e,x2-20-c-e,y2-10-e); {pravaya noga}
Line(x2-20-c-e,y2-10-e,x2-16-c-e,y2-3-e);
Line(x2-16-c-e,y2-3-e,x2-18-c-e,y2-e);
Line(x2-20-c-e,y2-20-e,x2-25-c-e,y2-10-e); {levaya noga}
Line(x2-25-c-e,y2-10-e,x2-20-c-e,y2-3-e);
Line(x2-20-c-e,y2-3-e,x2-25-c-e,y2-e);
end;
procedure DrawPeople7(var x1,y2,c,e:integer);
Begin
Circle(x1+25+c,y2-45-e-c,5);
Line(x1+25+c,y2-40-e-c,x1+25+c,y2-25-e-c); {tulovishe}
Line(x1+25+c,y2-40-e-c,x1+35+c,y2-25-e-c); {pravaya ruka}
Line(x1+25+c,y2-40-e-c,x1+15+c,y2-25-e-c); {levaya ruka}
Line(x1+25+c,y2-25-e-c,x1+30+c,y2-18-e-c); {pravaya noga}
Line(x1+30+c,y2-18-e-c,x1+30+c,y2-9-e-c);
Line(x1+25+c,y2-25-e-c,x1+18+c,y2-18-e-c); {levaya noga}
Line(x1+18+c,y2-18-e-c,x1+18+c,y2-3-e-c);
end;
procedure DrawPeople8(var x1,y2,c,e:integer);
Begin
Circle(x1+25+c,y2-45-e-c,5);
Line(x1+25+c,y2-40-e-c,x1+25+c,y2-25-e-c); {tulovishe}
Line(x1+25+c,y2-40-e-c,x1+35+c,y2-25-e-c); {pravaya ruka}
Line(x1+25+c,y2-40-e-c,x1+15+c,y2-25-e-c); {levaya ruka}
Line(x1+25+c,y2-25-e-c,x1+32+c,y2-18-e-c); {pravaya noga}
Line(x1+32+c,y2-18-e-c,x1+32+c,y2-3-e-c);
Line(x1+25+c,y2-25-e-c,x1+20+c,y2-20-e-c); {levaya noga}
Line(x1+20+c,y2-20-e-c,x1+20+c,y2-9-e-c);
end;
Begin
clrscr;
Writeln('Vvedite kolichestvo krugov');
Read(n);
for i:=1 to 3 do
Begin
Writeln('Vvedite skorost ',i,' sportsmena');
Read(MaxV[i]);
end;
Driver:=Detect;
InitGraph(Driver,Mode,'');
Error:=GraphResult;
If Error<>grOk then
Writeln(GraphErrorMsg(Error))
else
Begin
CheckResolution(a,b);
for i:=1 to 3 do
Begin
Info[i].AddX:=0;
Info[i].AddY:=0;
Info[i].AddX2:=0;
Info[i].AddY2:=0;
Info[i].NCircle:=-1;
Info[i].FStop:=false;
For j:=2 to 4 do
Info[i].F[j]:=False;
end;
For i:=1 to 3 do
Info[i].F[1]:=True;
DrawRectangle(a,b,x1,x2,y1,y2);
For i:=1 to 3 do
Begin
DrawPeople0(x1,y1,c);
c:=c+50;
end;
key:=Readkey;
If key=#13 then
Begin
While true do
Begin
c:=0;
DrawRectangle(a,b,x1,x2,y1,y2);
For i:=1 to 3 do
Begin
If (Info[i].F[1]) and (not(Info[i].FStop)) and (Info[i].AddX+x1+150<x2-c) then
Begin
DrawPeople1(x1,y1,Info[i].AddX,c);
If (Info[i].AddX+MaxV[i]>=0) and (Info[i].AddX+MaxV[i]<=MaxV[i]) then
Info[i].NCircle:=Info[i].NCircle+1;
If Info[i].NCircle=n then
Info[i].FStop:=true;
Info[i].AddX:=Info[i].AddX+MaxV[i];
Flag1:=true;
End;
c:=c+50;
If Info[i].AddX+x1+100>=x2-c then
Begin
Info[i].F[1]:=False;
Info[i].F[2]:=True;
End;
End;
c:=0;
For i:=1 to 3 do
Begin
If Info[i].FStop then
Begin
DrawPeople0(x1,y1,c);
Flag1:=true;
end;
c:=c+50;
end;
c:=0;
If (Info[1].NCircle=n) and (Info[2].NCircle=n) and (Info[3].NCircle=n) then
break;
For i:=1 to 3 do
Begin
If (Info[i].F[2]) and (not(Info[i].FStop)) and (Info[i].AddY+y1+c+50<y2-c) then
Begin
DrawPeople3(x2,y1,c,Info[i].AddY);
Info[i].AddY:=Info[i].AddY+MaxV[i];
Flag1:=true;
End;
If (Info[i].AddY+y1+c+50>=y2-c) and (Info[i].AddY<>0) and (Info[i].F[1]=false) then
Begin
Info[i].F[2]:=False;
Info[i].F[3]:=True;
End;
c:=c+50;
End;
c:=0;
For i:=1 to 3 do
Begin
If (Info[i].F[3]) and (not(Info[i].FStop)) and (x1+Info[i].AddX2+c<x2-c-50) then
Begin
DrawPeople5(x2,y2,Info[i].AddX2,c);
Info[i].AddX2:=Info[i].AddX2+MaxV[i];
Flag1:=true;
End;
If Info[i].AddX2+x1+c>=x2-c-50 then
Begin
Info[i].F[3]:=False;
Info[i].F[4]:=True;
End;
c:=c+50;
End;
c:=0;
For i:=1 to 3 do
Begin
If (Info[i].F[4]) and (not(Info[i].FStop)) and (y1+Info[i].AddY2+c<y2-c-50) then
Begin
DrawPeople7(x1,y2,c,Info[i].AddY2);
Info[i].AddY2:=Info[i].AddY2+MaxV[i];
Flag1:=true;
End;
If Info[i].AddY2+y1+c>=y2-c-50 then
Begin
Info[i].F[4]:=False;
Info[i].F[1]:=True;
End;
c:=c+50;
End;
c:=0;
If Flag1 then
Begin
Delay(17000);
ClearDevice;
DrawRectangle(a,b,x1,x2,y1,y2);
Flag1:=false;
end;
For i:=1 to 3 do
Begin
If (Info[i].F[1]) and (not(Info[i].FStop)) and (Info[i].AddX+x1+150<x2-c) then
Begin
DrawPeople2(x1,y1,Info[i].AddX,c);
If Info[i].NCircle=n then
Info[i].FStop:=true;
If (Info[i].AddX+MaxV[i]>=0) and (Info[i].AddX+MaxV[i]<=MaxV[i]) then
Info[i].NCircle:=Info[i].NCircle+1;
Info[i].AddX:=Info[i].AddX+MaxV[i];
Flag2:=true;
End;
If Info[i].AddX+x1+100>=x2-c then
Begin
Info[i].F[1]:=False;
Info[i].F[2]:=True;
End;
c:=c+50;
End;
If (Info[1].NCircle=n) and (Info[2].NCircle=n) and (Info[3].NCircle=n) then
break;
c:=0;
For i:=1 to 3 do
Begin
If (Info[i].F[2]) and (not(Info[i].FStop)) and (Info[i].AddY+y1+c+50<y2-c) then
Begin
DrawPeople4(x2,y1,c,Info[i].AddY);
Info[i].AddY:=Info[i].AddY+MaxV[i];
Flag2:=true;
End;
If (Info[i].AddY+y1+c+50>=y2-c) and (Info[i].AddY<>0) and (Info[i].F[1]=false) then
Begin
Info[i].F[2]:=False;
Info[i].F[3]:=True;
End;
c:=c+50;
End;
c:=0;
For i:=1 to 3 do
Begin
If (Info[i].F[3]) and (not(Info[i].FStop)) and (x1+Info[i].AddX2+c<x2-c-50) then
Begin
DrawPeople6(x2,y2,Info[i].AddX2,c);
Info[i].AddX2:=Info[i].AddX2+MaxV[i];
Flag2:=true;
End;
If Info[i].AddX2+x1+c>=x2-c-50 then
Begin
Info[i].F[3]:=False;
Info[i].F[4]:=True;
End;
c:=c+50;
End;
c:=0;
For i:=1 to 3 do
Begin
If (Info[i].F[4]) and (not(Info[i].FStop)) and (y1+Info[i].AddY2+c<y2-c-50) then
Begin
DrawPeople8(x1,y2,c,Info[i].AddY2);
Info[i].AddY2:=Info[i].AddY2+MaxV[i];
Flag2:=true;
End;
If Info[i].AddY2+y1+c>=y2-c-50 then
Begin
Info[i].F[4]:=False;
Info[i].F[1]:=True;
Info[i].AddX:=-100+c;
Info[i].AddY:=0;
Info[i].AddX2:=0;
Info[i].AddY2:=0;
End;
c:=c+50;
End;
c:=0;
For i:=1 to 3 do
Begin
If Info[i].FStop then
Begin
DrawPeople0(x1,y1,c);
Flag1:=true;
end;
c:=c+50;
end;
If Flag2 then
Begin
Delay(17000);
ClearDevice;
DrawRectangle(a,b,x1,x2,y1,y2);
Flag2:=false;
end;
c:=0;
End;
ClearDevice;
DrawRectangle(a,b,x1,x2,y1,y2);
For i:=1 to 3 do
Begin
DrawPeople0(x1,y1,c);
c:=c+50;
end;
End;
End;
Readkey;
End.
Revise this Paste