{-------------domain 4.1----------------------------------}
Rectangle(routers[4].x-39,routers[4].y-82,routers[4].x-13,routers[4].y-70);
FloodFill(routers[4].x-37,routers[4].y-81,white);
Line(routers[4].x-4,routers[4].y-10,routers[4].x-25,routers[4].y-70);
Circle(routers[4].x-40,routers[4].y-105,8);
FloodFill(routers[4].x-40,routers[4].y-105,white);
Line(routers[4].x-25,routers[4].y-75,routers[4].x-40,routers[4].y-105);
Circle(routers[4].x-60,routers[4].y-70,8);
FloodFill(routers[4].x-60,routers[4].y-70,white);
Line(routers[4].x-25,routers[4].y-75,routers[4].x-60,routers[4].y-70);
Circle(routers[4].x-40,routers[4].y-50,8);
FloodFill(routers[4].x-40,routers[4].y-50,white);
Line(routers[4].x-25,routers[4].y-75,routers[4].x-40,routers[4].y-50);
{-------------domain 4.2----------------------------------}
Rectangle(routers[4].x+25,routers[4].y-35,routers[4].x+45,routers[4].y-5);
FloodFill(routers[4].x+27,routers[4].y-33,white);
Circle(routers[4].x+57,routers[4].y-25,8);
FloodFill(routers[4].x+57,routers[4].y-25,white);
Circle(routers[4].x+77,routers[4].y-25,8);
FloodFill(routers[4].x+77,routers[4].y-25,white);
Circle(routers[4].x+97,routers[4].y-25,8);
FloodFill(routers[4].x+97,routers[4].y-25,white);
Circle(routers[4].x+117,routers[4].y-25,8);
FloodFill(routers[4].x+117,routers[4].y-25,white);
Line(routers[4].x+9,routers[4].y-7,routers[4].x+20,routers[4].y-25);
Line(routers[4].x+20,routers[4].y-25,routers[4].x+127,routers[4].y-25);
{-------------domain 5.1----------------------------------}
Rectangle(routers[5].x-30,routers[5].y-130,routers[5].x-10,routers[5].y-100);
FloodFill(routers[5].x-25,routers[5].y-128,white);
Line(routers[5].x,routers[5].y-10,routers[5].x-20,routers[5].y-120);
Circle(routers[5].x-48,routers[5].y-90,8);
FloodFill(routers[5].x-48,routers[5].y-120+30,white);
Line(routers[5].x-20,routers[5].y-120,routers[5].x-48,routers[5].y-90);
Circle(routers[5].x-50,routers[5].y-120,8);
FloodFill(routers[5].x-50,routers[5].y-120,white);
Line(routers[5].x-20,routers[5].y-120,routers[5].x-50,routers[5].y-120);
Circle(routers[5].x-25,routers[5].y-150,8);
FloodFill(routers[5].x-25,routers[5].y-150,white);
Line(routers[5].x-20,routers[5].y-120,routers[5].x-25,routers[5].y-150);
Circle(routers[5].x+2,routers[5].y-150,8);
FloodFill(routers[5].x+2,routers[5].y-150,white);
Line(routers[5].x-20,routers[5].y-120,routers[5].x+2,routers[5].y-150);
{-------------domain 6.1----------------------------------}
Rectangle(routers[6].x-30,routers[6].y-10,routers[6].x-14,routers[6].y+14);
FloodFill(routers[6].x-28,routers[6].y-8,white);
Circle(routers[6].x-42,routers[6].y,8);
FloodFill(routers[6].x-42,routers[6].y,white);
Circle(routers[6].x-62,routers[6].y,8);
FloodFill(routers[6].x-62,routers[6].y,white);
Circle(routers[6].x-82,routers[6].y,8);
FloodFill(routers[6].x-82,routers[6].y,white);
Line(routers[6].x-10,routers[6].y,routers[6].x-92,routers[6].y);
{-------------domain 7.1----------------------------------}
Rectangle(routers[7].x-10,routers[7].y-50,routers[7].x+10,routers[7].y-25);
FloodFill(routers[7].x-8,routers[7].y-48,white);
Line(routers[7].x,routers[7].y-10,routers[7].x,routers[7].y-50);
Circle(routers[7].x-35,routers[7].y-20,8);
FloodFill(routers[7].x-35,routers[7].y-20,white);
Line(routers[7].x,routers[7].y-50,routers[7].x-35,routers[7].y-20);
Circle(routers[7].x-35,routers[7].y-60,8);
FloodFill(routers[7].x-35,routers[7].y-60,white);
Circle(routers[7].x+15,routers[7].y-70,8);
FloodFill(routers[7].x+15,routers[7].y-70,white);
Line(routers[7].x,routers[7].y-50,routers[7].x+15,routers[7].y-70);
Line(routers[7].x,routers[7].y-50,routers[7].x-35,routers[7].y-60);
SetColor(cyan);
OuttextXY(18,routers[1].y-32,'4');
OuttextXY(38,routers[1].y-32,'3');OuttextXY(58,routers[1].y-32,'2');
OutTextXY(routers[1].x-48,routers[1].y-48,'FS');
OuttextXY(78,routers[1].y-32,'1');
OutTextXY(routers[1].x+8,routers[1].y+60,'1');
OutTextXY(routers[1].x-50,routers[1].y+60,'6');
OutTextXY(routers[1].x-50,routers[1].y+89,'5');
OutTextXY(routers[1].x-45,routers[1].y+113,'4');
OutTextXY(routers[1].x-20,routers[1].y+112,'3');
OutTextXY(routers[1].x-28,routers[1].y+82,'hub');
OutTextXY(routers[1].x+11,routers[1].y+111,'2');
OutTextXY(routers[2].x-24,routers[2].y+72,'modem');
OutTextXY(routers[2].x-26,routers[2].y+98,'1');
OutTextXY(routers[2].x-78,routers[2].y+12,'FS');
OutTextXY(routers[2].x-73,routers[2].y+24,'1');
OutTextXY(routers[2].x-112,routers[2].y+18,'2');
OutTextXY(routers[2].x-142,routers[2].y+18,'3');
OutTextXY(routers[3].x-42,routers[3].y-45,'FS');
OutTextXY(routers[3].x-38,routers[3].y-30,'1');
OutTextXY(routers[3].x-62,routers[3].y-40,'2');
OutTextXY(routers[3].x-82,routers[3].y-40,'3');
OutTextXY(routers[4].x-37,routers[4].y-80,'hub');
OutTextXY(routers[4].x-42,routers[4].y-107,'1');
OutTextXY(routers[4].x-62,routers[4].y-73,'2');
OutTextXY(routers[4].x-42,routers[4].y-53,'3');
OutTextXY(routers[4].x+28,routers[4].y-33,'FS');
OutTextXY(routers[4].x+33,routers[4].y-20,'1');
OutTextXY(routers[4].x+55,routers[4].y-27,'2');
OutTextXY(routers[4].x+75,routers[4].y-27,'3');
OutTextXY(routers[4].x+95,routers[4].y-27,'4');
OutTextXY(routers[4].x+115,routers[4].y-27,'5');
OutTextXY(routers[5].x-27,routers[5].y-127,'FS');
OutTextXY(routers[5].x-21,routers[5].y-110,'1');
OutTextXY(routers[5].x-51,routers[5].y-92,'2');
OutTextXY(routers[5].x-51,routers[5].y-122,'3');
OutTextXY(routers[5].x-27,routers[5].y-152,'4');
OutTextXY(routers[5].x,routers[5].y-152,'5');
OutTextXY(routers[6].x-29,routers[6].y-8,'FS');
OutTextXY(routers[6].x-25,routers[6].y+4,'1');
OutTextXY(routers[6].x-44,routers[6].y-2,'2');
OutTextXY(routers[6].x-64,routers[6].y-2,'3');
OutTextXY(routers[6].x-84,routers[6].y-2,'4');
OutTextXY(routers[7].x-7,routers[7].y-48,'FS');
OutTextXY(routers[7].x-2,routers[7].y-35,'1');
OutTextXY(routers[7].x-37,routers[7].y-22,'2');
OutTextXY(routers[7].x-37,routers[7].y-62,'3');
OutTextXY(routers[7].x+12,routers[7].y-72,'4');
SetColor(white);
OutTextXY(10,230,'Domain 1.1');OutTextXY(10,338,'Domain 1.2');
OutTextXY(200,220,'Domain 2.1');OutTextXY(110,150,'Domain 2.2');
OutTextXY(210,240,'Domain 3.1');
OutTextXY(170,320,'Domain 4.1');OutTextXY(330,370,'Domain 4.2');
OutTextXY(430,250,'Domain 5.1');
OutTextXY(450,175,'Domain 6.1');
{-------------router numbers-------------------------}
SetColor(black);
OutTextXY(routers[1].x-2,routers[1].y-2,'1');
OutTextXY(routers[2].x-2,routers[2].y-2,'2');
OutTextXY(routers[3].x-2,routers[3].y-2,'3');
OutTextXY(routers[4].x-2,routers[4].y-2,'4');
OutTextXY(routers[5].x-2,routers[5].y-2,'5');
OutTextXY(routers[6].x-2,routers[6].y-2,'6');
OutTextXY(routers[7].x-2,routers[7].y-2,'7');
if second then begin
setlinestyle(0,0,3);
setcolor({white}green);
for i:=1 to OptPathPtr-2 do
Line(routers[OptimalPath[i]].x,routers[OptimalPath[i]].y,
routers[OptimalPath[i+1]].x,routers[OptimalPath[i+1]].y);
while not keypressed do
for i:=1 to 63 do SetRGBPalette(green,0,i,0);
end;
if not second then while not keypressed do
for i:=1 to 63 do SetRGBPalette(red,i,0,0);
End;
Procedure ShowTime(x,y :integer);
VAR h, m, s, hund : Word;
Function LeadingZero(w : Word) : String;
var s : String;
begin
Str(w:0,s);
if Length(s) = 1 then s := '0' + s;
LeadingZero := s;
Begin
GetTime(h,m,s,hund);TextColor(Green);GotoXY(x,y);Write(LeadingZero(h),':',
LeadingZero(m),':',LeadingZero(s),'.',LeadingZero(hund));
Function Dist (x1,y1,x2,y2:longint):longint;
var temp:longint;
temp:=sqr(x2-x1)+sqr(y2-y1);
temp:=trunc((sqrt(temp)));
Dist:=temp;
{-----------------objects implementation part-----------------}
{---------------Computer procedures---------------}
Procedure TComp.Send2Router(batch:TBatch);{send batch to it's router}
VAR i:byte;tmpFrom:TAddr;
Delay(DelaySendToRouter);
tmpFrom:=batch.from;
i:=batch.from.router;
routers[i].memory:=batch;{router receive data from his domain's computer}
showtime(wherex,wherey);
writeln('> ',tmpFrom.router,'.',tmpFrom.domain,'.',tmpFrom.comp,
' says : I send data ','"',batch.data,'"',' for ',batch.to_.router,'.',batch.to_.domain,'.',
Страницы: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17