aboutsummaryrefslogtreecommitdiff
path: root/go.py
blob: d4efc1bd9f89d489beab4b069b52219e7b64939a (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
30
31
32
#!/usr/bin/python

"""Play Go!"""

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

if __name__ == "__main__":

    GAMESTATE = GameState(5)
    #GAMESTATE = GameState(19)

    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()

        player = str(GAMESTATE.getPlayerCode())

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

        GAMESTATE.playMove(moveRow, moveCol)