text
stringlengths
0
234
Move_From := -1;Move_To := -1;My_Col := Black;
while True loop
<<Do_It_Again>>
if Col/=My_Col or Xboard_Force then
if Xboard_Force then Read_Xboard(-1,-1);
else Read_Xboard(Move_From,Move_To); end if;
if Movenum /= 0 then --xtime est maintenant a jour
Put(Game_Log," {[%eval ");
if Res<-9999 then
Res := -(9999-(Res+32766));
elsif
Res>9999 then
Res:=9999+(Res-32766);
end if;
Fixed_Io.Put(Game_Log,My_Fixed(Float(Res)));
Put(Game_Log,"]");
Put(Game_Log,"[%emt ");
Tmp := Integer(Dur+0.5);
Put(Game_Log,Convert_Clock(Tmp));
Put(Game_Log,"]");
Put(Game_Log,"[%clk ");
Put(Game_Log,Convert_Clock((Xtime+50)/100));
Put(Game_Log,"]");
Put(Game_Log,"}");
Flush(Game_Log);
end if;
if Xboard_From=-3 then
Init_Boards(Xboard_Fen(1..Xboard_Fen_Last),Col,Cast,En_Passant,Matw,Matb);
Put_Line(File_Log,"Material Start: "&Integer'Image(Matw)&" "&Integer'Image(Matb));
Init_Masks;
Init_Attacks;
Make_Z_I(Col);
My_Col := -Col;
Print_Chessboard(File_Log);
goto Do_It_Again;
end if;
Move_From := Xboard_From;
Move_To := Xboard_To;
Res := 0;
Put_Line(File_Log,"Color:"&Color'Image(Col)&" My_col:"&Color'Image(My_Col)&" xboard_force:"
&Boolean'Image(Xboard_Force));
if Move_From = -1 then My_Col := Col; end if;
Put_Line(File_Log,"Color:"&Color'Image(Col)&" My_col:"&Color'Image(My_Col)&" xboard_force:"
&Boolean'Image(Xboard_Force));
Print_Chessboard(File_Log);
end if;
if Movenum=0 then
Put_Line(File_Log,"Starting pgn log");
Put_Line(Game_Log,"[Event ""Freechess test""]");
Put_Line(Game_Log,"[Site ""Freechess""]");
Today := Clock;
Put_Line(Game_Log,"[Date """&
Integer'Image(Year(Today))&"."&
Integer'Image(Month(Today))&"."&
Integer'Image(Day(Today))&
"""]");
if XT1/=0 then
Put_Line(Game_Log,"[TimeControl """&Integer'Image(Xt1)&"/"&Integer'Image(Xt2*60)&
"""]");
else
if Xt3=0 then
Put_Line(Game_Log,"[TimeControl """&Integer'Image(Xt2*60)&"""]");
else
Put_Line(Game_Log,"[TimeControl """&Integer'Image(Xt2*60)&"+"&Integer'Image(Xt3)&"""]");
end if;
end if;
if My_Col=Black then
Put_Line(Game_Log,"[White """&Xname(1..Xname_Last)&"""]");
Put_Line(Game_Log,"[Black ""Lovelace""]");
Put_Line(Game_Log,"[WhiteElo """&Integer'Image(XratingO)&"""]");
Put_Line(Game_Log,"[BlackElo """&Integer'Image(XratingC)&"""]");
else
Put_Line(Game_Log,"[White ""Lovelace""]");
Put_Line(Game_Log,"[Black """&Xname(1..Xname_Last)&"""]");
Put_Line(Game_Log,"[WhiteElo """&Integer'Image(XratingC)&"""]");
Put_Line(Game_Log,"[BlackElo """&Integer'Image(XratingO)&"""]");
end if;
Put_Line(Game_Log,"");
Flush(Game_Log);
end if;
if Col = My_Col and not Xboard_Force Then
begin
Full_Start_Time := Clock;
Full_Start_Time_Real := Ada.Real_Time.Clock;
Move_From := -1;Move_To := -1;Old_From:=-1;Old_To:=-1;
Prof := 10;Alpha:=-32767;Beta:=32767;
Have_Time := Float(Xtime)/100.0;
if Have_Time<5.0 then Min_Delay:=0.2;
elsif Have_Time<15.0 then Min_Delay:=0.3;
elsif Have_Time<30.0 then Min_Delay:=0.5;
elsif Have_Time<60.0 then Min_Delay:=0.75;
elsif Have_Time<120.0 then Min_Delay:=1.0;
else Min_Delay := 1.5; end if;
Put_Line(File_Log,"Xtime="&Integer'Image(Xtime));
if Has_Book then
Get_Book(Move_From,Move_To,Col,Cast,En_Passant);