Skip to content

Commit 5f9bd51

Browse files
committed
fixed issue with crash
1 parent fb1f6b8 commit 5f9bd51

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

NoraGrace/NoraGrace.Engine/Search.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ public Args()
218218

219219
public event EventHandler<SearchProgressEventArgs> ProgressReported;
220220

221-
const int MAX_PLY = 50;
221+
public const int MAX_PLY = 50;
222222
private Move[][] _pv = new Move[MAX_PLY + 1][];
223223
private int[] _pvLen = new int[MAX_PLY + 1];
224224

@@ -302,11 +302,11 @@ public Progress Start()
302302
int MateScoreCount = 0;
303303

304304
var maxDepth = SearchDepthUtil.FromPly(Math.Min(MAX_PLY, this.SearchArgs.MaxDepth));
305-
SearchData searchData = new SearchData(SearchArgs.Eval, MAX_PLY);
305+
SearchData searchData = new SearchData(SearchArgs.Eval);
306306

307307
while (depth.Value() <= maxDepth.Value())
308308
{
309-
309+
310310
ValSearchRoot(searchData, depth);
311311

312312
//if we get three consecutive depths with same mate score.. just move.

NoraGrace/NoraGrace.Engine/SearchData.cs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,14 @@ public class SearchData
1515

1616
private readonly List<PlyData> _plyData = new List<PlyData>();
1717

18-
public SearchData(Evaluation.Evaluator evaluator, int maxPly)
18+
public SearchData(Evaluation.Evaluator evaluator)
1919
{
2020
Evaluator = evaluator;
2121
SEE = new StaticExchange();
2222
MoveHistory = new MovePicker.MoveHistory();
2323

2424
_plyData = new List<PlyData>();
25-
while (_plyData.Count <= maxPly - 1)
25+
while (_plyData.Count <= Search.MAX_PLY + 1)
2626
{
2727
_plyData.Add(new PlyData(this));
2828
}
@@ -31,7 +31,10 @@ public SearchData(Evaluation.Evaluator evaluator, int maxPly)
3131

3232
public PlyData this[int ply]
3333
{
34-
get { return _plyData[ply]; }
34+
get
35+
{
36+
return _plyData[ply];
37+
}
3538
}
3639

3740
}

0 commit comments

Comments
 (0)