text
stringlengths
0
234
end loop;
Put_Line("");
L := L+1;
if L<=8 then K:=L; else K := 16-L; end if;
Base := Base - K;
end loop;
end Print_Bitboard_45;
procedure Print_Chessboard is
K : Integer;
begin
for I in reverse 0..7 loop
for J in 0..7 loop
K := I*8+J;
if All_Pieces_B(K)=1 then
begin
if White_Rooks_B(K)=1 then Put("R "); end if;
if Black_Rooks_B(K)=1 then Put("r "); end if;
if White_Knights_B(K)=1 then Put("N "); end if;
if Black_Knights_B(K)=1 then Put("n "); end if;
if White_Bishops_B(K)=1 then Put("B "); end if;
if Black_Bishops_B(K)=1 then Put("b "); end if;
if White_Queens_B(K)=1 then Put("Q "); end if;
if Black_Queens_B(K)=1 then Put("q "); end if;
if White_Kings_B(K)=1 then Put("K "); end if;
if Black_Kings_B(K)=1 then Put("k "); end if;
if White_Pawns_B(K)=1 then Put("P "); end if;
if Black_Pawns_B(K)=1 then Put("p "); end if;
Function Definition: procedure Store is
Function Body: begin
Table(Ind).Low := Integer_16(Low); Table(Ind).High := Integer_16(High);
Table(Ind).From := Unsigned_6(From); Table(Ind).To := Unsigned_6(To);
Table(Ind).Prof := Integer_10(Prof); Table(Ind).Movenum := Unsigned_8(Movenum);
Table(Ind).Valid := Valid;Table(Ind).I := Z_I;
-- for I in 0..63 loop
-- Plus := Unsigned_4(Chess_Board(I));
--Codage bizarre transformant le codage du roi blanc (3) en 4
--Comme le 4 n'existe pas cela permet de stocker la couleur (!)
-- if Plus = 3 and C=Black then Plus:=4; end if;
-- Table(Ind).Board(I):=Plus;
-- end loop;
end Store;
pragma Inline(Store);
begin
Ind := Integer(Shift_Right(Z_I,64-Nb_Bits));
if Z_I = Table(Ind).I then
-- Exactly same position
if Prof >= Integer(Table(Ind).Prof) then
--Same position researched deeper
Store;
else
-- Same position, lower depth, store should not happen?
-- raise Hash_Error;
null;
end if;
else
-- New position=> collision. Shall we replace the other one?
if Movenum /= Integer(Table(Ind).Movenum) or else Prof >= Integer(Table(Ind).Prof) then
--store if different move, or better prof
Store;
end if;
end if;
Function Definition: function AddElemToAllLists (LL : Partition_Type; I : Integer) return Partition_Type
Function Body: is
-- sub function to add an integer to the front of a partition
function AddElemToFront (L : Partition; I : Integer) return Partition
is
RetL : Partition;
begin
for J in L'Range loop
-- adds to front
if (J = 0) then
RetL (J) := I;
-- cuts off last digit in initial partition
else
RetL (J) := L(J - 1);
end if;
end loop;
return RetL;
end AddElemToFront;
LLFirst : Partition := LL(0);
RetLL : Partition_Type (LL'Range);
begin
-- -1 is the initialization value for all indices in the array
if (LLFirst (0) = -1) then
return LL;
else
-- iterates through all lists and adds element
for J in LL'Range loop
RetLL (J) := AddElemToFront ((LL (J)), I);
end loop;
end if;
return RetLL;