@@ -20,6 +20,7 @@ public class IterativeSearch
2020 private History _history ;
2121 private KillSwitch _killSwitch ;
2222 private long _maxNodes ;
23+ private int _mobilityBonus ;
2324
2425 public IterativeSearch ( Board board , long maxNodes = long . MaxValue )
2526 {
@@ -38,7 +39,7 @@ public IterativeSearch(int searchDepth, Board board) : this(board)
3839 public void SearchDeeper ( Func < bool > killSwitch = null )
3940 {
4041 Depth ++ ;
41- _killers . Resize ( Depth ) ;
42+ _killers . Expand ( Depth ) ;
4243 _history . Scale ( ) ;
4344 StorePVinTT ( PrincipalVariation , Depth ) ;
4445 _killSwitch = new KillSwitch ( killSwitch ) ;
@@ -69,7 +70,7 @@ private void StorePVinTT(Move[] pv, int depth)
6970 {
7071 if ( depth <= 0 )
7172 {
72- Evaluation . DynamicScore = Evaluation . ComputeMobility ( position ) ;
73+ _mobilityBonus = Evaluation . ComputeMobility ( position ) ;
7374 return ( QEval ( position , window ) , Array . Empty < Move > ( ) ) ;
7475 }
7576
@@ -103,7 +104,7 @@ private void StorePVinTT(Move[] pv, int depth)
103104 //moves after the PV node are unlikely to raise alpha. try to avoid a full evaluation!
104105 if ( expandedNodes > 1 )
105106 {
106- bool tactical = isChecked || ( move . Promotion > Piece . Queen ) || child . IsChecked ( child . SideToMove ) ;
107+ bool tactical = isChecked || child . IsChecked ( child . SideToMove ) ;
107108
108109 //some moves are hopeless and can be skipped without deeper evaluation
109110 if ( depth <= 4 && ! tactical )
@@ -176,7 +177,7 @@ private int QEval(Board position, SearchWindow window)
176177 //if inCheck we can't use standPat, need to escape check!
177178 if ( ! inCheck )
178179 {
179- int standPatScore = Evaluation . DynamicScore + position . Score ;
180+ int standPatScore = position . Score + _mobilityBonus ;
180181 //Cut will raise alpha and perform beta cutoff when standPatScore is too good
181182 if ( window . Cut ( standPatScore , color ) )
182183 return window . GetScore ( color ) ;
0 commit comments