# A two-player board game, like tic-tac-toe, chess, etc:

# Data structure and its maintenance functions:

board = [ [...], [...], [...], ... ]

def printBoard():
    """printBoard  prints a representation of the board on the display"""
    for row in board :
        for square in row :
            print square,
        print
    print

def insert(who, row, col):
    """insert tries to insert a mark from player  who  
         at position  row,col  in the board
       parameters: who - a string ("X" or "O");  
                   row, col - ints, within the bounds of the board
       returns: True, if the move is successful; returns False, otherwise
    """
    successful_move = False
    if #...row within bounds... and ...col within bounds... :
        if #...board[row][col] unoccupied... :
            board[row][col] = who
            successful_move = True
    return successful_move


##### The controller part starts here:

def makeMove(who) :
    """makeMove gets a player's next move and tries to make the move.
       parameter: who - a string identifying the player ("X" or "O")
    """
    move = raw_input("Player" + who + " : Type the coordinates of the move: ")
    coordinates = move.split(",")
    row_coordinate = int(coordinates[0])
    column_coordinate = int(coordinates[1])
    insert(who, row_coordinate, column_coordinate)  # make a new
        # function that holds the picky details of insertion

# We hid the fussy details of board updating in function  insert.
# If the  board  must be altered later, then we need alter
#  only  insert  and not  makeMove.

game_on = True

while game_on :
    printBoard()
    makeMove("X")
    makeMove("O")

printBoard()
