Skip to content

Commit cb84f39

Browse files
committed
Revert removal of stdout flush, and call setoption once
1 parent 29a2209 commit cb84f39

1 file changed

Lines changed: 11 additions & 4 deletions

File tree

examples/bratko_kopec/bratko_kopec.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,10 @@ def test_epd(engine, epd, VariantBoard, threads, movetime):
2525
epd_string = "%s (expect %s)" % (epd_string, " or ".join(position.san(bm) for bm in epd_info["bm"]))
2626

2727
engine.ucinewgame()
28-
engine.setoption({"UCI_Variant": VariantBoard.uci_variant})
29-
engine.setoption({"Threads": threads})
28+
engine.setoption({
29+
"UCI_Variant": VariantBoard.uci_variant,
30+
"Threads": threads
31+
})
3032
engine.position(position)
3133

3234
enginemove, pondermove = engine.go(movetime=movetime)
@@ -55,8 +57,10 @@ def test_epd_with_fractional_scores(engine, epd, VariantBoard, threads, movetime
5557
epd_string = "%s (expect %s)" % (epd_string, " or ".join(position.san(bm) for bm in epd_info["bm"]))
5658

5759
engine.ucinewgame()
58-
engine.setoption({"UCI_Variant": VariantBoard.uci_variant})
59-
engine.setoption({"Threads": threads})
60+
engine.setoption({
61+
"UCI_Variant": VariantBoard.uci_variant,
62+
"Threads": threads
63+
})
6064
engine.position(position)
6165

6266
# Search in background
@@ -65,6 +69,7 @@ def test_epd_with_fractional_scores(engine, epd, VariantBoard, threads, movetime
6569
score = 0.0
6670

6771
print("%s:" % epd_string, end=" ")
72+
sys.stdout.flush()
6873

6974
for step in range(0, 3):
7075
time.sleep(movetime / 4000.0)
@@ -74,6 +79,7 @@ def test_epd_with_fractional_scores(engine, epd, VariantBoard, threads, movetime
7479
if 1 in info["pv"] and len(info["pv"][1]) >= 1:
7580
move = info["pv"][1][0]
7681
print("(%s)" % position.san(move), end=" ")
82+
sys.stdout.flush()
7783
if "am" in epd_info and move in epd_info["am"]:
7884
continue # fail
7985
elif "bm" in epd_info and move not in epd_info["bm"]:
@@ -82,6 +88,7 @@ def test_epd_with_fractional_scores(engine, epd, VariantBoard, threads, movetime
8288
score = 1.0 / (4 - step)
8389
else:
8490
print("(no pv)", end=" ")
91+
sys.stdout.flush()
8592

8693
# Assess the final best move by the engine.
8794
time.sleep(movetime / 4000.0)

0 commit comments

Comments
 (0)