"""
Framework for an Alqueque player in Python.
Replace the TODO comments with your own code.
(Joris)
"""
import sys
class Alquerque:
def __init__(self):
"""Initialize the game state."""
self.moveCount = 0
self.whiteTurn = True
# TODO : initialize a variable to hold the game board
def doMove(self, move):
"""Play a move and update the game state."""
# TODO : decode the move, update the game board
self.moveCount += 1
self.whiteTurn = not self.whiteTurn
def stillPlaying(self):
"""Return True if the game is not yet finished."""
if self.moveCount >= 200:
return False
# TODO : determine whether a move can be made by the player on turn
def selectMove(self):
"""Select a good move and return it as a string."""
# TODO
def main():
"""Main routine."""
# Initialize the game
game = Alquerque()
# Read the first line
s = sys.stdin.readline().strip().lower()
if s == 'start':
# I am playing white
game.whitePlayer = True
else:
# I am playing black; the first line contains white's first move
game.whitePlayer = False
game.doMove(s)
while game.stillPlaying():
# Select the move I want to make
move = game.selectMove()
game.doMove(move)
# Send my move to the system
sys.stdout.write(move + '\n')
sys.stdout.flush()
if game.stillPlaying():
# Read next move by opponent
s = sys.stdin.readline().strip().lower()
game.doMove(s)
"""Call main routine."""
main()
# End