Skip to content

Commit fbd77fa

Browse files
author
Ryan Delaney
committed
Rework var_end_comment(), takes Board not GameNode
Facilitates testing since a Board is somewhat easier to create on the fly than a GameNode
1 parent 25081b9 commit fbd77fa

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

annotator/__main__.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -233,12 +233,11 @@ def get_nags(judgment):
233233
return []
234234

235235

236-
def var_end_comment(node, judgment):
236+
def var_end_comment(board, judgment):
237237
"""
238238
Return a human-readable annotation explaining the board state (if the game
239239
is over) or a numerical evaluation (if it is not)
240240
"""
241-
board = node.board()
242241
score = judgment["bestcomment"]
243242
depth = judgment["depth"]
244243

@@ -293,7 +292,7 @@ def add_annotation(node, judgment):
293292

294293
# Add a comment to the end of the variation explaining the game state
295294
var_end_node = prev_node.variation(judgment["pv"][0]).end()
296-
var_end_node.comment = var_end_comment(var_end_node, judgment)
295+
var_end_node.comment = var_end_comment(var_end_node.board(), judgment)
297296

298297
# Add a Numeric Annotation Glyph (NAG) according to how weak the played move was
299298
node.nags = get_nags(judgment)

0 commit comments

Comments
 (0)