aboutsummaryrefslogtreecommitdiff
path: root/go.py
blob: 96f70525705bf5afc0c8f578bb5f13b05ce62cea (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
#!/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)