text
stringlengths 0
234
|
|---|
if Move_From/=-1 then
|
Put_Line(File_Log,"Raising end_thinking in get_book");
|
raise End_Thinking;
|
end if;
|
end if;
|
loop
|
Put_Line(File_Log,"Starting main loop");
|
Start_Time_real := Ada.Real_Time.Clock;
|
Start_Time := Clock;
|
if XT1/=0 then
|
Tmp := (Movenum/2) mod XT1;
|
Tmp := XT1 - Tmp;
|
Max_Delay := Have_Time/Float(Tmp+1);
|
Max_Delay := (4.0*Max_Delay)/3.0;
|
Put_Line(File_Log,"Max_delay="&Float'Image(Max_Delay)
|
&" Tmp="&Integer'Image(Tmp)&" Have_time="&Float'Image(Have_Time)
|
&" Movenum="&Integer'Image(Movenum));
|
else
|
Tmp := Integer'Max(30-abs(Matw+Matb)/100,10);
|
Max_Delay := Float(XT3)+Have_Time/Float(Tmp);
|
Put_Line(File_Log,
|
"Max_delay="&Float'Image(Max_Delay)
|
&" Have_time="&Float'Image(Have_Time)
|
&" Movenum="&Integer'Image(Movenum)
|
&" mat="&Integer'Image(Tmp));
|
end if;
|
if Max_Delay<Min_Delay then Max_Delay := Min_Delay; end if;
|
Put_Line(File_Log,"Max_delay="&Float'Image(Max_Delay));
|
Period := Ada.Real_Time.Milliseconds(Integer(1000.0*Max_Delay));
|
select
|
-- delay until (Start_Time+Duration(Max_Delay));
|
-- delay Duration(Max_Delay);
|
delay until (Full_Start_Time_Real+Period);
|
Restore_State(St);
|
for I in 0..63 loop Chess_Board(I) := Lcb(I); end loop;
|
Dur := Float(Clock-Full_Start_Time);
|
Real_Dur := Ada.Real_Time."-"(Ada.Real_Time.Clock,Full_Start_Time_Real);
|
Put_Line(File_Log,"Raising End_thinking in Interrupted. Dur:"&Float'Image(Dur)
|
& " Real_Dur:" & Duration'Image(Ada.Real_Time.To_Duration(Real_Dur))
|
& " Period:" & Ada.Real_Time.Time_Span'Image(Period)
|
& " Max_delay:"&Float'Image(Max_Delay));
|
raise End_Thinking;
|
then abort
|
Save_State(St);
|
for I in 0..63 loop Lcb(I):=Chess_Board(I); end loop;
|
Nb_Pos :=0; Nb_Moves_Made := 0;Hash_Hits :=0; Max_Prof :=0;
|
Fail_Low:=False;Fail_High:=False;
|
loop
|
Put_Line(File_Log,"Starting inner loop prof="&Integer'Image(Prof)&" Alpha:"&
|
Integer'Image(Alpha)&" Beta"&Integer'Image(Beta));
|
Res := Gen_Moves(alpha,beta,Col,En_passant,Cast,0,False,Prof,Matw,Matb,False);
|
Put_Line(File_Log,"In loop res:"&Integer'Image(Res));
|
if Res+Prof/10=32766 or Res-Prof/10=-32766 then
|
-- Mate
|
Put_Line(File_Log,"Raising end_thinking because res=32766 or res=-32766");
|
raise End_Thinking;
|
end if;
|
if Res>Alpha and Res<Beta then exit; end if;
|
if Res<=Alpha then Alpha:= -32767;Beta:=Res+1;Fail_Low:=True;
|
else Beta:=32767;Alpha:=Res-1; Fail_High:=True;End if;
|
if Fail_Low and Fail_High then
|
Alpha := -32767;Beta:=32767;
|
Put_Line(File_Log,"**************Double Fail****************");
|
end if;
|
end loop;
|
Alpha := Res-10;Beta:=Res+10;
|
End_Time := Clock;
|
Dur := Float(End_Time-Start_Time);
|
Have_Time := Have_Time-Dur;
|
Put_Line(File_log,"Out of loop. Prof:"&Integer'Image(Prof)&" From:"&Convert_To_Pos(Move_From)&" To:"&Convert_To_Pos(Move_To)&" Val:"&Integer'Image(Res)&" Time:"&Float'Image(Dur)&" Have_time:"&Float'Image(Have_Time));
|
Old_From := Move_From; Old_To := Move_To;
|
Flush(File_Log);
|
if (Dur > Max_Delay/3.0) and (Float(End_Time-Full_Start_Time)>Min_Delay) then
|
Put_Line(File_Log,
|
"Raising end_thinking. Dur="&Float'Image(Dur)&
|
" max_delay="&Float'Image(Max_Delay)&
|
" min_delay="&Float'Image(Min_Delay));
|
raise End_Thinking;
|
end if;
|
if Prof>=2000 then
|
Put_Line(File_Log,"Raising End_thinking because prof>=2000");
|
raise End_Thinking;
|
end if;
|
Prof := Prof+10;
|
Put_Line(File_Log,"Adding 10 to prof. New prof:"&Integer'Image(Prof));
|
end select;
|
end loop;
|
exception
|
when End_Thinking =>
|
Put_Line(File_Log,"End thinking");
|
Real_Dur := Ada.Real_Time."-"(Ada.Real_Time.Clock,Full_Start_Time_Real);
|
Dur := Float(Clock-Full_Start_Time);
|
if Dur<Min_Delay then
|
Put_Line(File_Log,"Duration<Min_Delay: "&Float'Image(Dur)&Float'Image(Min_Delay)&" Adding time");
|
delay Duration(Min_Delay-Dur+(Float(AdaMT19937.Random(G))/Float(Unsigned_32'Last)/2.0));
|
end if;
|
Dur := Float(Clock-Full_Start_Time);
|
Put_Line(File_Log,"Real_time: "&Duration'Image(Ada.Real_Time.To_Duration(Real_Dur))&" Durée: "&Float'Image(Dur));
|
Flush(File_Log);
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.