aboutsummaryrefslogtreecommitdiff
path: root/go.py
blob: cf0a673a04fdbfd30e2fb898eeb3c17e48a68723 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/usr/bin/python

"""Play Go!"""

from imago.engine.parseHelpers import parseVertex
from imago.gameLogic.gameState import GameState

if __name__ == "__main__":

    GAMESTATE = GameState(9)

    while True:

        GAMESTATE.getBoard().printBoard()

        move = input("Move (" + GAMESTATE.getPlayerCode() + "): ")

        try:
            move = parseVertex(move, GAMESTATE.size)
        except Exception as err:
            print("Invalid move syntax. Example of move: A1")
            continue

        print()

        moveRow = move[0]
        moveCol = move[1]

        GAMESTATE.playMove(moveRow, moveCol)