text
stringlengths
0
234
Rank_Mobility(I,Integer(J)) := 0;
Rank_Mobility_90(I,Integer(J)) := 0;
Rank_Mobility_45r(I,Integer(J)) := 0;
Rank_Mobility_45l(I,Integer(J)) := 0;
R:=0;
for K in reverse 0 .. Ind-1 loop
R := R or Shift_Left(1,K);
Rank_Mobility(I,Integer(J)) := Rank_Mobility(I,Integer(J))+1;
exit when (J and Shift_Left(1,K))/=0;
end loop;
for K in Ind+1 .. 7 loop
R := R or Shift_Left(1,K);
Rank_Mobility(I,Integer(J)) := Rank_Mobility(I,Integer(J))+1;
exit when (J and Shift_Left(1,K))/=0;
end loop;
Rank_Attacks_I(I,Integer(J)) := Shift_Left(Intboard(R),(8*Base));
end loop;
end loop;
for I in 0..7 loop
for J in 0..7 loop
for M in 0..255 loop
for B in 0..7 loop
Rank_Attacks_90_B(8*I+J,M)(8*(7-B)+J) := Rank_Attacks_B(7-I,M)(B);
if Rank_Attacks_B(7-I,M)(B)=1 then
Rank_Mobility_90(8*I+J,M):= Rank_Mobility_90(8*I+J,M)+1;
end if;
end loop;
end loop;
end loop;
end loop;
for B in 0..63 loop
L := To_45r(B);
for J in 0..(2**Length_45r(L)-1) loop
Rank_Attacks_45r_I(B,J) := 0;
Final_I := Rank_Attacks_I(Pos_45r(L),J) and (2**Length_45r(L)-1);
for K in 0 .. Length_45r(L)-1 loop
D := From_45r(K+Start_45r(L));
Rank_Attacks_45r_B(B,J)(D) := Final_B(K);
if Final_B(K)=1 then
Rank_Mobility_45r(B,J):=Rank_Mobility_45r(B,J)+1;
end if;
end loop;
end loop;
end loop;
for B in 0..63 loop
L := To_45l(B);
for J in 0..(2**Length_45l(L)-1) loop
Rank_Attacks_45l_I(B,J) := 0;
Final_I := Rank_Attacks_I(Pos_45l(L),J) and (2**Length_45l(L)-1);
for K in 0 .. Length_45l(L)-1 loop
D := From_45l(K+Start_45l(L));
Rank_Attacks_45l_B(B,J)(D) := Final_B(K);
if Final_B(K)=1 then
Rank_Mobility_45l(B,J):=Rank_Mobility_45l(B,J)+1;
end if;
end loop;
end loop;
end loop;
end Init_Rank_Attacks;
procedure Init_Attacks is
begin
Init_Knight_Attacks;
Init_King_Attacks;
Init_White_Pawn_Attacks;
Init_Black_Pawn_Attacks;
Init_White_Pawn_Moves1;
Init_Black_Pawn_Moves1;
Init_White_Pawn_Moves2;
Init_Black_Pawn_Moves2;
Init_Rank_Attacks;
end Init_Attacks;
procedure Print_Bitboard (B:Bitboard) is
begin
for I in reverse 0..7 loop
for J in 0 .. 7 loop
if B(I*8+J)=1 then Put("X "); else Put(". "); end if;
end loop;
Put_Line("");
end loop;
end Print_Bitboard;
procedure Print_Bitboard_45 (B:Bitboard) is
L : Integer := 1;
K : Integer := 1;
Base : Integer := 63;
begin
while L <=15 loop
for I in 1..8-K loop
Put(" ");
end loop;
for I in Base..Base+K-1 loop
if B(I)=1 then Put("X "); else Put(". "); end if;
Put(" ");