fix scoring display

This commit is contained in:
s3lph 2022-10-02 17:19:51 +02:00
parent bde19234ba
commit 89a7dcd5f2

View file

@ -149,11 +149,18 @@ Press Play! to play against GNU Go or invite a second player.
ret = self._gtp(f'final_status_list {state}') ret = self._gtp(f'final_status_list {state}')
vertices = ret.replace('\n', ' ').split(' ') vertices = ret.replace('\n', ' ').split(' ')
for vertex in vertices: for vertex in vertices:
if len(vertex.strip()) != 2: vertex = vertex.strip()
if len(vertex) < 2, 3:
continue
x = vertex[0]
y = vertex[1:]
try:
row = int(y) - 1
except:
continue continue
x, y = vertex.strip()
row = int(y) - 1
col = self.colnames.index(x.upper()) col = self.colnames.index(x.upper())
if col is None:
continue
if state == 'dead': if state == 'dead':
if self._field[row][col] == FieldState.BLACK.value: if self._field[row][col] == FieldState.BLACK.value:
self._field[row][col] = FieldState.BLACK_DEAD.value self._field[row][col] = FieldState.BLACK_DEAD.value