Code Samples

Templates and scripts to get you started quickly.

The play_turn API

def play_turn(board, piece_to_place, pieces_left):
    empty = [i for i, v in enumerate(board) if v is None]
    cell = empty[0]
    next_piece = pieces_left[0] if pieces_left else None
    return cell, next_piece
    

Win condition: 4 pieces in a row, column, or diagonal sharing at least one attribute value.

agent_template.py play_vs_agent.py play_vs_random.py