Commit e8b9ff6
[4/9] Improve quiescence search
Enhances quiescence search with better handling of special positions:
**Draw Detection:**
- Check fifty-move rule and insufficient material
- Detect repetitions when making moves (return 0 for draws)
**Check Handling:**
- When in check, search ALL legal moves (evasions), not just captures
- Can't use stand-pat for pruning when in check (position is unstable)
- Separate best_score tracking for in-check vs normal positions
**Tactical Move Detection:**
- Add `is_tactical_move()` helper function
- Tactical moves: captures, promotions, and checks
- Previously included quiet pawn pushes (is_zeroing), now more precise
**Move Ordering:**
- Update `organize_moves_quiescence()` to use is_tactical_move
- Sort tactical moves by MVV-LVA
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>1 parent 82526b0 commit e8b9ff6
2 files changed
Lines changed: 74 additions & 25 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
105 | 105 | | |
106 | 106 | | |
107 | 107 | | |
108 | | - | |
109 | | - | |
| 108 | + | |
110 | 109 | | |
111 | 110 | | |
112 | 111 | | |
113 | 112 | | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
114 | 121 | | |
115 | 122 | | |
116 | | - | |
117 | | - | |
118 | | - | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
119 | 139 | | |
120 | | - | |
121 | | - | |
122 | | - | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
123 | 143 | | |
124 | | - | |
125 | | - | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
126 | 147 | | |
127 | | - | |
128 | | - | |
| 148 | + | |
| 149 | + | |
129 | 150 | | |
130 | 151 | | |
131 | 152 | | |
132 | 153 | | |
133 | | - | |
134 | | - | |
135 | | - | |
136 | | - | |
137 | | - | |
138 | | - | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
139 | 166 | | |
140 | 167 | | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
141 | 171 | | |
142 | 172 | | |
143 | 173 | | |
144 | 174 | | |
145 | 175 | | |
146 | 176 | | |
147 | 177 | | |
148 | | - | |
| 178 | + | |
149 | 179 | | |
150 | 180 | | |
151 | 181 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
35 | 49 | | |
36 | 50 | | |
37 | 51 | | |
38 | 52 | | |
39 | 53 | | |
| 54 | + | |
| 55 | + | |
40 | 56 | | |
41 | 57 | | |
42 | 58 | | |
43 | 59 | | |
44 | | - | |
| 60 | + | |
45 | 61 | | |
46 | 62 | | |
47 | | - | |
48 | | - | |
49 | | - | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
50 | 68 | | |
51 | 69 | | |
52 | | - | |
| 70 | + | |
| 71 | + | |
53 | 72 | | |
54 | | - | |
| 73 | + | |
55 | 74 | | |
56 | 75 | | |
57 | 76 | | |
| |||
0 commit comments