Skip to content

Commit a66c73d

Browse files
mcostalbazamar
authored andcommitted
Allow Position::init() to be called more than once
Currently Zobrist::castling[] are not properly zeroed and rely on the compiler to do this at startup, but this makes Position::init() to set different values every time it is called! This is a bit odd, and although not impacting normal usage, can yield to subtle misbehaviour, very difficult to track down, in case we happen to call it more than once for some reason. I found this while developing tuning support and it took me a while to track it down. So properly init Zobrist::castling[] No functional change. Resolves #329
1 parent 27efc5a commit a66c73d

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

src/position.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,7 @@ void Position::init() {
149149

150150
for (int cr = NO_CASTLING; cr <= ANY_CASTLING; ++cr)
151151
{
152+
Zobrist::castling[cr] = 0;
152153
Bitboard b = cr;
153154
while (b)
154155
{

src/ucioption.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
#include <algorithm>
2121
#include <cassert>
22-
#include <sstream>
22+
#include <ostream>
2323

2424
#include "misc.h"
2525
#include "thread.h"

0 commit comments

Comments
 (0)