Rev 169 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 169 | Rev 185 | ||
|---|---|---|---|
| Line 4... | Line 4... | ||
| 4 |   Copyright (C) 2008-2015 Marco Costalba, Joona Kiiski, Tord Romstad | 4 |   Copyright (C) 2008-2015 Marco Costalba, Joona Kiiski, Tord Romstad | 
| 5 |   Copyright (C) 2015- | 5 |   Copyright (C) 2015-2019 Marco Costalba, Joona Kiiski, Gary Linscott, Tord Romstad | 
| 6 | 6 | ||
| 7 |   Stockfish is free software: you can redistribute it and/or modify | 7 |   Stockfish is free software: you can redistribute it and/or modify | 
| 8 |   it under the terms of the GNU General Public License as published by | 8 |   it under the terms of the GNU General Public License as published by | 
| 9 |   the Free Software Foundation, either version 3 of the License, or | 9 |   the Free Software Foundation, either version 3 of the License, or | 
| 10 |   (at your option) any later version. | 10 |   (at your option) any later version. | 
| Line 27... | Line 27... | ||
| 27 | #include "types.h" | 27 | #include "types.h" | 
| 28 | 28 | ||
| 29 | namespace { | 29 | namespace { | 
| 30 | 30 | ||
| 31 |   // There are 24 possible pawn squares: the first 4 files and ranks from 2 to 7 | 31 |   // There are 24 possible pawn squares: the first 4 files and ranks from 2 to 7 | 
| 32 | 
 | 32 | constexpr unsigned MAX_INDEX = 2*24*64*64; // stm * psq * wksq * bksq = 196608 | 
| 33 | 33 | ||
| 34 |   // Each uint32_t stores results of 32 positions, one per bit | 34 |   // Each uint32_t stores results of 32 positions, one per bit | 
| 35 | uint32_t KPKBitbase[MAX_INDEX / 32]; | 35 | uint32_t KPKBitbase[MAX_INDEX / 32]; | 
| 36 | 36 | ||
| 37 |   // A KPK bitbase index is an integer in [0, IndexMax] range | 37 |   // A KPK bitbase index is an integer in [0, IndexMax] range | 
| Line 150... | Line 150... | ||
| 150 |     // Black to move: If one move leads to a position classified as DRAW, the result | 150 |     // Black to move: If one move leads to a position classified as DRAW, the result | 
| 151 |     // of the current position is DRAW. If all moves lead to positions classified | 151 |     // of the current position is DRAW. If all moves lead to positions classified | 
| 152 |     // as WIN, the position is classified as WIN, otherwise the current position is | 152 |     // as WIN, the position is classified as WIN, otherwise the current position is | 
| 153 |     // classified as UNKNOWN. | 153 |     // classified as UNKNOWN. | 
| 154 | 154 | ||
| 155 | 
 | 155 | constexpr Color Them = (Us == WHITE ? BLACK : WHITE); | 
| 156 | 
 | 156 | constexpr Result Good = (Us == WHITE ? WIN : DRAW); | 
| 157 | 
 | 157 | constexpr Result Bad = (Us == WHITE ? DRAW : WIN); | 
| 158 | 158 | ||
| 159 | Result r = INVALID; | 159 | Result r = INVALID; | 
| 160 | Bitboard b = PseudoAttacks[KING][ksq[Us]]; | 160 | Bitboard b = PseudoAttacks[KING][ksq[Us]]; | 
| 161 | 161 | ||
| 162 | while (b) | 162 | while (b) |