next player

This commit is contained in:
Sander Land committed 2020-12-27 17:08:41 +01:00
1 parent 5e187f2b2e
commit 38ddc8e37a
1 file changed
+8 -2
+8 -2
View File
@@ -304,9 +304,15 @@ class SGFNode:
"""Returns player to move"""
if "PL" in self.properties: # explicit
return "B" if self.get_property("PL").upper().strip() == "B" else "W"
elif "B" in self.properties or (
elif self.children: # child exist, use it if not placement
for child in self.children:
for color in "BW":
if color in child.properties:
return color
# b move or setup with only black moves like root handicap
if "B" in self.properties or (
"AB" in self.properties and "W" not in self.properties and "AW" not in self.properties
): # b move or setup with only black moves like root handicap
):
return "W"
else:
return "B"