aboutsummaryrefslogtreecommitdiff
path: root/go.py
diff options
context:
space:
mode:
authorInigoGutierrez <inigogf.95@gmail.com>2022-07-01 16:10:15 +0200
committerInigoGutierrez <inigogf.95@gmail.com>2022-07-01 16:10:15 +0200
commitb08408d23186205e71dfc68634021e3236bfb45c (patch)
tree55e5679b6964902dadab1d5737546cfd4f0f2f0a /go.py
parentddde2a9a43daf870c26bef33f47abe45b414c3d0 (diff)
downloadimago-b08408d23186205e71dfc68634021e3236bfb45c.tar.gz
imago-b08408d23186205e71dfc68634021e3236bfb45c.zip
First version.
Diffstat (limited to 'go.py')
-rwxr-xr-xgo.py14
1 files changed, 6 insertions, 8 deletions
diff --git a/go.py b/go.py
index 548df38..cf0a673 100755
--- a/go.py
+++ b/go.py
@@ -2,29 +2,27 @@
"""Play Go!"""
-from imago.engine.parseHelpers import ParseCodes, parseVertex
+from imago.engine.parseHelpers import parseVertex
from imago.gameLogic.gameState import GameState
if __name__ == "__main__":
- #GAMESTATE = GameState(5)
- GAMESTATE = GameState(19)
+ GAMESTATE = GameState(9)
- while 1:
+ while True:
GAMESTATE.getBoard().printBoard()
move = input("Move (" + GAMESTATE.getPlayerCode() + "): ")
- move = parseVertex(move, GAMESTATE.size)
- if move == ParseCodes.ERROR:
+ try:
+ move = parseVertex(move, GAMESTATE.size)
+ except Exception as err:
print("Invalid move syntax. Example of move: A1")
continue
print()
- player = str(GAMESTATE.getPlayerCode())
-
moveRow = move[0]
moveCol = move[1]