Rev 96 | Rev 169 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 96 | Rev 154 | ||
|---|---|---|---|
| Line 35... | Line 35... | ||
| 35 | 35 | ||
| 36 | Score pawns_score() const { return score; } |
36 | Score pawns_score() const { return score; } |
| 37 | Bitboard pawn_attacks(Color c) const { return pawnAttacks[c]; } |
37 | Bitboard pawn_attacks(Color c) const { return pawnAttacks[c]; } |
| 38 | Bitboard passed_pawns(Color c) const { return passedPawns[c]; } |
38 | Bitboard passed_pawns(Color c) const { return passedPawns[c]; } |
| 39 | Bitboard pawn_attacks_span(Color c) const { return pawnAttacksSpan[c]; } |
39 | Bitboard pawn_attacks_span(Color c) const { return pawnAttacksSpan[c]; } |
| 40 | int pawn_span(Color c) const { return pawnSpan[c]; } |
- | |
| 41 | int pawn_asymmetry() const { return asymmetry; } |
40 | int pawn_asymmetry() const { return asymmetry; } |
| - | 41 | int open_files() const { return openFiles; } |
|
| 42 | 42 | ||
| 43 | int semiopen_file(Color c, File f) const { |
43 | int semiopen_file(Color c, File f) const { |
| 44 | return semiopenFiles[c] & (1 << f); |
44 | return semiopenFiles[c] & (1 << f); |
| 45 | } |
45 | } |
| 46 | 46 | ||
| Line 51... | Line 51... | ||
| 51 | int pawns_on_same_color_squares(Color c, Square s) const { |
51 | int pawns_on_same_color_squares(Color c, Square s) const { |
| 52 | return pawnsOnSquares[c][!!(DarkSquares & s)]; |
52 | return pawnsOnSquares[c][!!(DarkSquares & s)]; |
| 53 | } |
53 | } |
| 54 | 54 | ||
| 55 | template<Color Us> |
55 | template<Color Us> |
| 56 | Score king_safety(const Position& pos, Square ksq) |
56 | Score king_safety(const Position& pos, Square ksq) { |
| 57 | return kingSquares[Us] == ksq && castlingRights[Us] == pos.can_castle(Us) |
57 | return kingSquares[Us] == ksq && castlingRights[Us] == pos.can_castle(Us) |
| 58 | ? kingSafety[Us] : (kingSafety[Us] = do_king_safety<Us>(pos, ksq)); |
58 | ? kingSafety[Us] : (kingSafety[Us] = do_king_safety<Us>(pos, ksq)); |
| 59 | } |
59 | } |
| 60 | 60 | ||
| 61 | template<Color Us> |
61 | template<Color Us> |
| Line 71... | Line 71... | ||
| 71 | Bitboard pawnAttacksSpan[COLOR_NB]; |
71 | Bitboard pawnAttacksSpan[COLOR_NB]; |
| 72 | Square kingSquares[COLOR_NB]; |
72 | Square kingSquares[COLOR_NB]; |
| 73 | Score kingSafety[COLOR_NB]; |
73 | Score kingSafety[COLOR_NB]; |
| 74 | int castlingRights[COLOR_NB]; |
74 | int castlingRights[COLOR_NB]; |
| 75 | int semiopenFiles[COLOR_NB]; |
75 | int semiopenFiles[COLOR_NB]; |
| 76 | int pawnSpan[COLOR_NB]; |
- | |
| 77 | int pawnsOnSquares[COLOR_NB][COLOR_NB]; // [color][light/dark squares] |
76 | int pawnsOnSquares[COLOR_NB][COLOR_NB]; // [color][light/dark squares] |
| 78 | int asymmetry; |
77 | int asymmetry; |
| - | 78 | int openFiles; |
|
| 79 | }; |
79 | }; |
| 80 | 80 | ||
| 81 | typedef HashTable<Entry, 16384> Table; |
81 | typedef HashTable<Entry, 16384> Table; |
| 82 | 82 | ||
| 83 | void init(); |
83 | void init(); |