@@ -176,14 +176,18 @@ def play(version1_version2_secs_plus_fen):
176
176
if m is not None :
177
177
pos = pos .move (m )
178
178
# Test repetition draws
179
+ # This is by far the most common type of draw
179
180
if pos in seen :
180
181
return None
181
182
seen .add (pos )
182
183
else :
183
184
if score == 0 :
185
+ # This is actually a bit interesting. Why would we ever throw away a win like this?
186
+ print ('Stalemate?' , tools .renderFEN (pos ))
184
187
return None
185
- assert score <= - sunfish .MATE_LOWER , "We lost ?"
188
+ assert score <= - sunfish .MATE_LOWER , "move is None, but we didn't lose ?"
186
189
return version1 if d % 2 == 1 else version2
190
+ print ('Game too long' , tools .renderFEN (pos ))
187
191
return None
188
192
189
193
@@ -207,12 +211,12 @@ def test_xboard(python='python3', verbose=True):
207
211
if verbose :
208
212
print ('Xboard test \' %s\' ' % python )
209
213
fish = subprocess .Popen (
210
- [python , '-u' , 'tools .py' ],
214
+ [python , '-u' , 'xboard .py' ],
211
215
stdin = subprocess .PIPE , stdout = subprocess .PIPE ,
212
216
universal_newlines = True )
213
217
214
218
def wait_for (regex ):
215
- with timeout (20 , '%s was never encountered' % regex ):
219
+ with timeout (20 , '{} was never encountered' . format ( regex ) ):
216
220
while True :
217
221
line = fish .stdout .readline ()
218
222
if verbose :
@@ -262,9 +266,9 @@ def allperft(f, depth=4, verbose=True):
262
266
print ('ERROR at depth %d. Gave %d rather than %d' % (d , res , score ))
263
267
print ('=========================================' )
264
268
print (tools .renderFEN (pos ,0 ))
265
- sunfish . print_pos ( pos )
266
- #print(' '.join(renderSAN(pos, 0, mov) for mov in pos.gen_moves() ))
267
- print (' ' . join ( sunfish . render ( m [ 0 ]) + sunfish . render ( m [ 1 ]) for m in pos . gen_moves () ))
269
+ for move in pos . gen_moves ():
270
+ split = sum ( 1 for _ in tools . collect_tree_depth ( tools . expand_position ( pos .move ( move )), 1 ))
271
+ print ('{}: {}' . format ( tools . mrender ( pos , move ), split ))
268
272
return False
269
273
if verbose :
270
274
print ('' )
0 commit comments