diff options
author | InigoGutierrez <inigogf.95@gmail.com> | 2022-09-13 16:16:08 +0200 |
---|---|---|
committer | InigoGutierrez <inigogf.95@gmail.com> | 2022-09-13 16:16:08 +0200 |
commit | 95a42188701405ce15b77ae80832c670e307fbb9 (patch) | |
tree | 198bff4d944a7bebbbc534f362037e96c581a11e | |
parent | d1a53544e82d54797a8073081538999a16e7b4ca (diff) | |
download | imago-95a42188701405ce15b77ae80832c670e307fbb9.tar.gz imago-95a42188701405ce15b77ae80832c670e307fbb9.zip |
Configuring nvim LSP.
-rw-r--r-- | imago/engine/core.py | 3 | ||||
-rw-r--r-- | imago/engine/imagoIO.py | 14 |
2 files changed, 12 insertions, 5 deletions
diff --git a/imago/engine/core.py b/imago/engine/core.py index 2bf7d5a..47c8f16 100644 --- a/imago/engine/core.py +++ b/imago/engine/core.py @@ -8,10 +8,11 @@ DEF_SIZE = 9 DEF_KOMI = 5.5 DEF_ALGORITHM = DecisionAlgorithms.KERAS + class GameEngine: """Plays the game of Go.""" - def __init__(self, decisionAlgorithmId = DEF_ALGORITHM): + def __init__(self, decisionAlgorithmId=DEF_ALGORITHM): self.komi = DEF_KOMI self.gameState = GameState(DEF_SIZE) self.daId = decisionAlgorithmId diff --git a/imago/engine/imagoIO.py b/imago/engine/imagoIO.py index 9b3e367..9a89095 100644 --- a/imago/engine/imagoIO.py +++ b/imago/engine/imagoIO.py @@ -5,36 +5,43 @@ import sys from imago.engine import parseHelpers from imago.engine.core import GameEngine + def _response(text=""): print("= %s" % text) print() + def _responseError(text=""): print("? %s" % text) print() + def protocol_version(_): """Version of the GTP Protocol""" _response("2") + def name(_): """Name of the engine""" _response("Imago") + def version(_): """Version of the engine""" _response("0.0.0") + def getCoordsText(row, col): """Returns a string representation of row and col. In GTP A1 is bottom left corner. """ - return "%s%d" % (chr(65+row), col+1) + return "%s%d" % (chr(65 + row), col + 1) + class ImagoIO: """Recieves and handles commands.""" - def __init__(self, decisionAlgorithmId = None): + def __init__(self, decisionAlgorithmId=None): self.commands_set = { protocol_version, name, @@ -72,7 +79,6 @@ class ImagoIO: if command is not None: arguments = input_tokens[1:] - #print("[DEBUG]:Selected command: %s; args: %s" % (command, arguments)) command(arguments) else: _responseError("unknown command") @@ -169,7 +175,7 @@ class ImagoIO: return color = parseHelpers.parseColor(args[0]) output = parseHelpers.vertexToString(self.gameEngine.genmove(color), - self.gameEngine.gameState.size) + self.gameEngine.gameState.size) _response(output) self.gameEngine.gameState.getBoard().printBoard() |