From 89a7dcd5f2cb2144e5fbb04216ad10dfe5ed5483 Mon Sep 17 00:00:00 2001 From: s3lph Date: Sun, 2 Oct 2022 17:19:51 +0200 Subject: [PATCH] fix scoring display --- webgames/go.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/webgames/go.py b/webgames/go.py index 9d877f9..e47421e 100644 --- a/webgames/go.py +++ b/webgames/go.py @@ -149,11 +149,18 @@ Press Play! to play against GNU Go or invite a second player. ret = self._gtp(f'final_status_list {state}') vertices = ret.replace('\n', ' ').split(' ') 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 - x, y = vertex.strip() - row = int(y) - 1 col = self.colnames.index(x.upper()) + if col is None: + continue if state == 'dead': if self._field[row][col] == FieldState.BLACK.value: self._field[row][col] = FieldState.BLACK_DEAD.value