Rev 108 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 108 | Rev 154 | ||
|---|---|---|---|
| Line 1... | Line 1... | ||
| 1 | #include "chess.h" | 1 | #include "chess.h" | 
| 2 | #include "data.h" | 2 | #include "data.h" | 
| 3 | /* last modified  | 3 | /* last modified 08/03/16 */ | 
| 4 | /* | 4 | /* | 
| 5 |  ******************************************************************************* | 5 |  ******************************************************************************* | 
| 6 |  *                                                                             * | 6 |  *                                                                             * | 
| 7 |  *   Ponder() is the driver for "pondering" (thinking on the opponent's time.) * | 7 |  *   Ponder() is the driver for "pondering" (thinking on the opponent's time.) * | 
| 8 |  *   its operation is simple:  Find a predicted move by (a) taking the second  * | 8 |  *   its operation is simple:  Find a predicted move by (a) taking the second  * | 
| Line 22... | Line 22... | ||
| 22 |  */ | 22 |  */ | 
| 23 | int Ponder(int wtm) { | 23 | int Ponder(int wtm) { | 
| 24 | TREE *const tree = block[0]; | 24 | TREE *const tree = block[0]; | 
| 25 | int dalpha = -999999, dbeta = 999999, i; | 25 | int dalpha = -999999, dbeta = 999999, i; | 
| 26 | unsigned *n_ponder_moves, *mv; | 26 | unsigned *n_ponder_moves, *mv; | 
| 27 | int save_move_number, tlom, value; | 27 | int save_move_number, tlom, value, illegal = 0; | 
| 28 | 28 | ||
| 29 | /* | 29 | /* | 
| 30 |  ************************************************************ | 30 |  ************************************************************ | 
| 31 |  *                                                          * | 31 |  *                                                          * | 
| 32 |  *  First, let's check to see if pondering is allowed, or   * | 32 |  *  First, let's check to see if pondering is allowed, or   * | 
| Line 93... | Line 93... | ||
| 93 | if (!ponder_move) { | 93 | if (!ponder_move) { | 
| 94 | TimeSet(puzzle); | 94 | TimeSet(puzzle); | 
| 95 | if (time_limit < 20) | 95 | if (time_limit < 20) | 
| 96 | return 0; | 96 | return 0; | 
| 97 | puzzling = 1; | 97 | puzzling = 1; | 
| 98 | tree->status[1] = tree->status[0]; | - | |
| 99 | Print(32, " puzzling over a move to ponder.\n"); | 98 | Print(32, " puzzling over a move to ponder.\n"); | 
| 100 | last_pv.pathl = 0; | 99 | last_pv.pathl = 0; | 
| 101 | last_pv.pathd = 0; | 100 | last_pv.pathd = 0; | 
| 102 | for (i = 0; i < MAXPLY; i++) { | 101 | for (i = 0; i < MAXPLY; i++) { | 
| 103 | tree->killers[i].move1 = 0; | 102 | tree->killers[i].move1 = 0; | 
| Line 153... | Line 152... | ||
| 153 | n_ponder_moves = GenerateCaptures(tree, 0, wtm, ponder_moves); | 152 | n_ponder_moves = GenerateCaptures(tree, 0, wtm, ponder_moves); | 
| 154 |   num_ponder_moves = | 153 |   num_ponder_moves = | 
| 155 | GenerateNoncaptures(tree, 0, wtm, n_ponder_moves) - ponder_moves; | 154 | GenerateNoncaptures(tree, 0, wtm, n_ponder_moves) - ponder_moves; | 
| 156 | for (mv = ponder_moves; mv < ponder_moves + num_ponder_moves; mv++) { | 155 | for (mv = ponder_moves; mv < ponder_moves + num_ponder_moves; mv++) { | 
| 157 | MakeMove(tree, 0, wtm, *mv); | 156 | MakeMove(tree, 0, wtm, *mv); | 
| 158 | 
 | 157 | illegal = Check(wtm); | 
| 159 | 
 | 158 | UnmakeMove(tree, 0, wtm, *mv); | 
| - | 159 | if (illegal) | |
| 160 | *mv = 0; | 160 | *mv = 0; | 
| 161 | } else | - | |
| 162 | UnmakeMove(tree, 0, wtm, *mv); | - | |
| 163 |   } | 161 |   } | 
| 164 | /* | 162 | /* | 
| 165 |  ************************************************************ | 163 |  ************************************************************ | 
| 166 |  *                                                          * | 164 |  *                                                          * | 
| 167 |  *  Now, perform an iterated search, but with the special   * | 165 |  *  Now, perform an iterated search, but with the special   * |