aboutsummaryrefslogtreecommitdiff
path: root/go.py
diff options
context:
space:
mode:
authorInigoGutierrez <inigogf.95@gmail.com>2021-01-24 20:47:26 +0100
committerInigoGutierrez <inigogf.95@gmail.com>2021-01-24 20:59:17 +0100
commitddde2a9a43daf870c26bef33f47abe45b414c3d0 (patch)
tree52576f8a97011f733360bc9904f1890867cd8bfd /go.py
downloadimago-ddde2a9a43daf870c26bef33f47abe45b414c3d0.tar.gz
imago-ddde2a9a43daf870c26bef33f47abe45b414c3d0.zip
First commit!
Diffstat (limited to 'go.py')
-rwxr-xr-xgo.py31
1 files changed, 31 insertions, 0 deletions
diff --git a/go.py b/go.py
new file mode 100755
index 0000000..548df38
--- /dev/null
+++ b/go.py
@@ -0,0 +1,31 @@
+#!/usr/bin/python
+
+"""Play Go!"""
+
+from imago.engine.parseHelpers import ParseCodes, parseVertex
+from imago.gameLogic.gameState import GameState
+
+if __name__ == "__main__":
+
+ #GAMESTATE = GameState(5)
+ GAMESTATE = GameState(19)
+
+ while 1:
+
+ GAMESTATE.getBoard().printBoard()
+
+ move = input("Move (" + GAMESTATE.getPlayerCode() + "): ")
+ move = parseVertex(move, GAMESTATE.size)
+
+ if move == ParseCodes.ERROR:
+ print("Invalid move syntax. Example of move: A1")
+ continue
+
+ print()
+
+ player = str(GAMESTATE.getPlayerCode())
+
+ moveRow = move[0]
+ moveCol = move[1]
+
+ GAMESTATE.playMove(moveRow, moveCol)