uses GenUnit,Graph;
const
  cx = 320;
  cy = 20;

var
  World     : CWorld;
  Adam, Eva, Avel : PCreature;
  Cr1,Cr2   : TChromos;
  pos       : Tvec;

Procedure EnumWriteCreature(aCr : PCreature);far;
begin
  WriteLn(aCr^.Gender,'-',aCr^.Size,'-',ord(aCr^.color));
end;

Procedure EnumDrawCreature(aCr : PCreature);far;
begin
  SetColor(ord(aCr^.color));
  if aCr^.Gender = 'W' then
    Circle(round(aCr^.Pos.x+cx),round(aCr^.Pos.y+cy),round(aCr^.size))
  else
    Rectangle(round(aCr^.Pos.x+cx-aCr^.size),round(aCr^.Pos.y+cy-aCr^.size),
	      round(aCr^.Pos.x+cx+aCr^.size),round(aCr^.Pos.y+cy+aCr^.size));
end;
var
 grDriver: Integer;
 grMode: Integer;
 ErrCode: Integer;
begin
{ grDriver := Detect;
 InitGraph(grDriver, grMode,'..');}
  randomize;

  Cr1[CR_X][GEN_X_GENDER] := $FF;Cr2[CR_X][GEN_X_GENDER] := $FF;
  Cr1[CR_X][GEN_X_COL_RG] := $FF;Cr2[CR_X][GEN_X_COL_RG] := 0;
  Cr1[CR_X][GEN_X_COL_BA] := 0;Cr2[CR_X][GEN_X_COL_BA] := $FF;
  Cr1[CR_X][GEN_X_SIZE] := $FF;Cr2[CR_X][GEN_X_SIZE] := $FF;
  Cr1[CR_X][GEN_X_MIND] := 0;Cr2[CR_X][GEN_X_MIND] := 0;
  Cr1[CR_X][GEN_X_AGE1] := $FF;Cr2[CR_X][GEN_X_AGE1] := 0;
  Cr1[CR_X][GEN_X_AGE2] := 0;Cr2[CR_X][GEN_X_AGE2] := 0;
  Pos.X:=-50;Pos.Y:=0;
  Eva := World.AddNewCreature(Pos,Cr1,Cr2,nil,nil);
  Cr2[CR_X][GEN_X_GENDER] := 0;Cr1[CR_X][GEN_X_COL_RG] := 0;
  Cr2[CR_X][GEN_X_COL_RG] := $FF;Cr1[CR_X][GEN_X_COL_BA] := 0;
  Cr2[CR_X][GEN_X_COL_BA] := 0;Cr1[CR_X][GEN_X_SIZE] := 0;
  Cr2[CR_X][GEN_X_SIZE] := 0;Cr1[CR_X][GEN_X_MIND] := $FF;
  Cr2[CR_X][GEN_X_MIND] := 0;Cr1[CR_X][GEN_X_AGE1] := 0;
  Cr2[CR_X][GEN_X_AGE1] := 0;Cr1[CR_X][GEN_X_AGE2] := 0;
  Cr2[CR_X][GEN_X_AGE2] := 0;
  Pos.X:=50;Pos.Y:=0;
  Adam := World.AddNewCreature(Pos,Cr1,Cr2,nil,nil);
  Pos.X:=-20;Pos.Y:=10;
  Avel := World.CreateChild(Pos,Eva,Adam);
  Pos.X:=20;Pos.Y:=10;
  World.CreateChild(Pos,Eva,Adam);
  World.CreateChild(Pos,Eva,Adam);
  World.CreateChild(Pos,Eva,Adam);

  World.CreateChild(Pos,Avel,Avel);
  World.CreateChild(Pos,Avel,Avel);
  World.CreateChild(Pos,Avel,Avel);
  World.CreateChild(Pos,Avel,Avel);

{  World.ForEachCreature(EnumDrawCreature);}
  World.ForEachCreature(EnumWriteCreature);
  ReadLn;
  World.Done;
{  CloseGraph;}
end.