Otchet (990402), страница 2
Текст из файла (страница 2)
if Image6.Visible then begin
Image6.Visible := false;
Image5.Visible := true;
end
else begin
Image5.Visible := false;
Image6.Visible := true;
end;
end;
end;
5: begin
kph := 'anoth';
inc(anc);
// проверяем все машины!
for I := 1 to 10 do begin
//Проверяем все машины которые проехали светофор
if ((cars[i].Act)and(cars[i].Pict.Left<616 )) then begin
//Прверяем те, которые уже доехали до конца
if cars[i].Pict.Left=8 then begin
cars[i].Act := false;
cars[i].Pict.Visible := false;
colact := colact-1;
end;
//не доехали до конца
if cars[i].Pict.Left>8 then cars[i].Pict.Left := cars[i].Pict.Left -2;
end;
//Проверяем все машины которые на светофоре
if ((cars[i].Act)and(cars[i].Pict.Left=616 )) then begin
if ((not(peshmesh))and (Image6.Visible )) then
cars[i].Pict.Left := cars[i].Pict.Left -2;
end;
//Проверяем все машины которые еще до светофора
if ((cars[i].Act)and(cars[i].Pict.Left>616 )) then begin
if bligcar(i)>=80 then
cars[i].Pict.Left := cars[i].Pict.Left -2;
end;
//если можно еще поставить машину (теоретически)
if cars[i].Act= false then begin
cars[i].Pict.Left:=720;
randomize;
rnd := random(3);
if rnd=1 then cars[i].Pict.Top := 168;
if rnd=2 then cars[i].Pict.Top := 218;
randomize;
rnd := random(100);
// showmessage(IntToStr(bligcar(i)));
if ((bligcar(i)>=80)and(rnd>70)and (anc >= 10)) then begin
cars[i].Act:=true;
cars[i].Pict.Visible := true;
anc :=0;
end;
end;
cartest;
end;
end; //*
6: begin
Image1.Left := 8;
Image2.Left := 8;
Image3.Left := 8;
Image8.Left := Image8.Left + 150;
car.shagN:=0;
end;
7: begin
ShowMessage('Ура!!!');
end;
end; //case таблицы 1
end; // конец таблицы 1
//----------------------Таблица 2 Действия---------------------------------------
2: begin //2
case message.LParam of
1: begin
if car.snij = false then forw
else begin
if car.hod<Car.urS then car.hod := car.hod+1 else begin
car.hod := 0;
car.urS := car.urS+1;
forw;
end;
end;
end;
2: begin
car.snij := true;
end;
3: begin
car.hod := 0;
car.urS := 0;
car.snij := false;
end;
4: begin
end;
end; //case таблицы 2
end; // конец таблицы 2
//----------------------Действия 3----------------------------------------------
3: begin //3
case message.LParam of
1: begin
delay(1);
man.go := false;
end;
2: begin
forwpesh;
man.go := true;
end;
3: begin
if man.napr=-2 then man.napr := 2 else man.napr := -2;
man.shag:=0;
end;
end; //case таблицы 3
end; // конец таблицы 3
//----------------------------------------------------
end; // закончили
res := true;
end; // действия
if res then message.result:=1 else
message.result:=0;
end // end of case na DEISTVIYA
else inherited WndProc(Message);
end; // end // of proc wnd
procedure TForm1.FormCreate(Sender: TObject);
begin
MsgSIMPR:= RegisterWindowMessage(MESSAGE_STR);
beg := true;
Image6.Visible := true;
man.napr := -2;
car.hod:=0;
car.urS:=0;
Form1.Image1.Visible := false;
Form1.Image2.Visible := false;
Form1.Image3.Visible := false;
anC := 0;
colAct := 0;
end;
end.
15















