You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
//Note: Returning a 6 is not intended, and must be handled on a case-by-case basis.
257
-
None => 6
258
-
}
259
-
}
260
-
261
-
fnmatch_int_to_piece(input:u8) -> Piece{
262
-
match input {
263
-
0 => Piece::Pawn,
264
-
1 => Piece::Knight,
265
-
2 => Piece::Bishop,
266
-
3 => Piece::Rook,
267
-
4 => Piece::Queen,
268
-
5 => Piece::King,
269
-
//Any other input to the function besides 0..5 is terrible behaviour from the input case, and should not happen. I'm simply going to *not* handle that case. Good luck!
270
-
6_u8..=u8::MAX => unimplemented!()
271
-
}
272
-
}
273
-
274
247
let material_each_side = utils::material_each_side(board);
//The psqt tables and bitboards are flipped vertically, hence .reverse_colors(). Reverse colors is for some reason faster than replacing i with 56-i+2*(i%8).
288
261
//By being tapered, it means that we have an (opening + middlgame) and an endgame PSQT, and we (hopefully?) linerarly transition from one to the other, depending on material value.
//Essentially, gets the dot product between a "vector" of the bitboard (containing 64 0s and 1s) and the table with NAIVE_PSQT bonus constants.
502
+
//Essentially, gets the dot product between a "vector" of the bitboard (containing 64 0s and 1s) and the table with TAPERED_PRESTO_PSQT bonus constants.
530
503
letmut bonus:f32 = 0.;
531
504
//Get's the bitboard with all piece positions, and runs bitwise and for the board having one's own colors.
532
505
//Iterates over all 64 squares on the board.
533
506
for i in0..63{
534
507
//The psqt tables and bitboards are flipped vertically, hence .reverse_colors(). Reverse colors is for some reason faster than replacing i with 56-i+2*(i%8).
535
508
//By being tapered, it means that we have an (opening + middlgame) and an endgame PSQT, and we (hopefully?) linerarly transition from one to the other, depending on material value.
//stacked pawns. -0.5 points per rank containing >1 pawns. By taking the pawn bitboard and operating bitwise AND for another bitboard (integer) where the leftmost rank is filled. This returns all pawns in that rank. By bitshifting we can choose rank. Additionally by counting we get number of pawns. We then remove 1 as we only want to know if there are >1 pawn. If there is, subtract 0.5 points per extra pawn.
569
542
for i in0..7{
570
543
//constant 9259542123273814144 = 0x8080808080808080, or the entire first rank.
//Any other input to the function besides 0..5 is terrible behaviour from the input case, and should not happen. I'm simply going to *not* handle that case. Good luck!
0 commit comments