#!/usr/bin/python """Play Go!""" import sys from imago.engine.parseHelpers import parseVertex from imago.gameLogic.gameState import GameState def runGame(): GAMESTATE = GameState(9) gameEnded = False while not gameEnded: 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() if move == "pass": GAMESTATE.playPass() if GAMESTATE.lastMove.previousMove.isPass: print("Both players passed: end of the game.") gameEnded = True else: moveRow = move[0] moveCol = move[1] GAMESTATE.playMove(moveRow, moveCol) if __name__ == "__main__": try: runGame() except KeyboardInterrupt as err: print() print("Quitting: End of the game.") sys.exit(0)