@@ -8,15 +8,6 @@ package main
88import "fmt"
99
1010func attackMap (brd * Board , occ BB , sq int ) BB {
11- // return ((pawn_attack_masks[BLACK][sq] & brd.pieces[WHITE][PAWN]) | // Pawns
12- // (pawn_attack_masks[WHITE][sq] & brd.pieces[BLACK][PAWN])) |
13- // (knight_masks[sq] & (brd.pieces[WHITE][KNIGHT] | brd.pieces[BLACK][KNIGHT])) | // Knights
14- // (bishop_attacks(occ, sq) & (brd.pieces[WHITE][BISHOP] | brd.pieces[BLACK][BISHOP] | // Bishops and Queens
15- // brd.pieces[WHITE][QUEEN] | brd.pieces[BLACK][QUEEN])) |
16- // (rook_attacks(occ, sq) & (brd.pieces[WHITE][ROOK] | brd.pieces[BLACK][ROOK] | // Rooks and Queens
17- // brd.pieces[WHITE][QUEEN] | brd.pieces[BLACK][QUEEN])) |
18- // (king_masks[sq] & (brd.pieces[WHITE][KING] | brd.pieces[BLACK][KING])) // Kings
19-
2011 bb := ((pawnAttackMasks [BLACK ][sq ] & brd.pieces [WHITE ][PAWN ]) |
2112 (pawnAttackMasks [WHITE ][sq ] & brd.pieces [BLACK ][PAWN ])) | // Pawns
2213 (knightMasks [sq ] & (brd.pieces [WHITE ][KNIGHT ] | brd.pieces [BLACK ][KNIGHT ])) | // Knights
@@ -31,12 +22,6 @@ func attackMap(brd *Board, occ BB, sq int) BB {
3122}
3223
3324func colorAttackMap (brd * Board , occ BB , sq int , c , e uint8 ) BB {
34- // return (pawn_attack_masks[e][sq] & brd.pieces[c][PAWN]) | // Pawns
35- // (knight_masks[sq] & brd.pieces[c][KNIGHT]) | // Knights
36- // (bishop_attacks(occ, sq) & (brd.pieces[c][BISHOP] | brd.pieces[c][QUEEN])) | // Bishops and Queens
37- // (rook_attacks(occ, sq) & (brd.pieces[c][ROOK] | brd.pieces[c][QUEEN])) | // Rooks and Queens
38- // (king_masks[sq] & brd.pieces[c][KING]) // Kings
39-
4025 bb := (pawnAttackMasks [e ][sq ] & brd.pieces [c ][PAWN ]) | // Pawns
4126 (knightMasks [sq ] & brd.pieces [c ][KNIGHT ]) | // Knights
4227 (kingMasks [sq ] & brd.pieces [c ][KING ]) // Kings
@@ -49,21 +34,6 @@ func colorAttackMap(brd *Board, occ BB, sq int, c, e uint8) BB {
4934 return bb
5035}
5136
52- // // attacks_after_move(brd, occ, occ&brd.occupied[e], king_sq, e, c)
53- //
54- // func attacks_after_move(brd *Board, all_occ, attacker_occ BB, sq int, attacker, defender uint8) BB {
55- //
56- // return (pawn_attack_masks[defender][sq] & brd.pieces[attacker][PAWN] & attacker_occ) | // Pawns
57- //
58- // (knight_masks[sq] & brd.pieces[attacker][KNIGHT]) | // Knights
59- //
60- // (bishop_attacks(all_occ, sq) & (brd.pieces[attacker][BISHOP]|brd.pieces[attacker][QUEEN])) | // Bishops and Queens
61- //
62- // (rook_attacks(all_occ, sq) & (brd.pieces[attacker][ROOK]|brd.pieces[attacker][QUEEN])) | // Rooks and Queens
63- //
64- // (king_masks[sq] & brd.pieces[attacker][KING]) // Kings
65- // }
66-
6737func isAttackedBy (brd * Board , occ BB , sq int , attacker , defender uint8 ) bool {
6838 if pawnAttackMasks [defender ][sq ]& brd.pieces [attacker ][PAWN ] > 0 { // Pawns
6939 return true
@@ -123,7 +93,7 @@ func isPinned(brd *Board, sq int, c, e uint8) BB {
12393// way of reducing the size of the q-search without impacting playing strength.
12494const (
12595 SEE_MIN = - 780 // worst possible outcome (trading a queen for a pawn)
126- SEE_MAX = 880 // best outcome (capturing an undefended queen)
96+ // SEE_MAX = 880 // best outcome (capturing an undefended queen)
12797)
12898
12999func getSee (brd * Board , from , to int , capturedPiece Piece ) int {
@@ -149,6 +119,7 @@ func getSee(brd *Board, from, to int, capturedPiece Piece) int {
149119 // this move is illegal and will be discarded by search. return the lowest possible
150120 // SEE value so that this move will be put at end of list. If cutoff occurs before then,
151121 // the cost of detecting the illegal move will be saved.
122+ // TODO: send this in UCI-compatible format
152123 fmt .Println ("king capture detected in getSee()!" )
153124 return SEE_MIN
154125 }
0 commit comments