diff options
Diffstat (limited to 'imago/engine/parseHelpers.py')
-rw-r--r-- | imago/engine/parseHelpers.py | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/imago/engine/parseHelpers.py b/imago/engine/parseHelpers.py index fc42845..64342d3 100644 --- a/imago/engine/parseHelpers.py +++ b/imago/engine/parseHelpers.py @@ -19,7 +19,7 @@ def parseMove(args, boardsize): """Converts the textual representation of a move to a move instance.""" if len(args) != 2: raise RuntimeError( - "Unable to transform string %s to move: Wrong format." + "Unable to transform string [%s] to move: Wrong format." % args) color = parseColor(args[0]) vertex = parseVertex(args[1], boardsize) @@ -32,7 +32,7 @@ def parseColor(text): return Player.WHITE if textUpper in VALID_BLACK_STRINGS: return Player.BLACK - raise RuntimeError("Unknown color %s." % text) + raise RuntimeError("Unknown color [%s]." % text) def parseVertex(text, boardSize): """Returns row and column of a vertex given its input string. A vertex can also be the @@ -47,7 +47,7 @@ def parseVertex(text, boardSize): if text == "PASS": return "pass" raise RuntimeError( - "Unable to transform string %s to vertex. Wrong format." + "Unable to transform string [%s] to vertex. Wrong format." % text) vertexCol = ord(text[0]) @@ -61,10 +61,10 @@ def parseVertex(text, boardSize): if (vertexCol < 0 or vertexRow < 0 or vertexCol >= boardSize or vertexRow >= boardSize): raise RuntimeError( - "Unable to transform string %s to vertex. Maps to [%d, %d], which is out of board bounds (size %d)" + "Unable to transform string [%s] to vertex. Maps to [%d, %d], which is out of board bounds (size [%d])" % (text, vertexCol, vertexRow, boardSize)) - return [vertexRow, vertexCol] + return (vertexRow, vertexCol) def vertexToString(vertex, boardSize): """Returns a string representing the vertex. @@ -76,11 +76,11 @@ def vertexToString(vertex, boardSize): return "pass" if len(vertex) != 2: raise RuntimeError( - "Unable to transform vertex %s to string. Too many elements." + "Unable to transform vertex [%s] to string. Too many elements." % str(vertex)) if vertex[0] >= boardSize or vertex[1] >= boardSize or vertex[0] < 0 or vertex[1] < 0: raise RuntimeError( - "Unable to transform vertex %s to string. Vertex out of board bounds (size %d)" + "Unable to transform vertex [%s] to string. Vertex out of board bounds (size [%d])" % (str(vertex), boardSize)) vertexRow = boardSize - vertex[0] |