def main():
    state = "---------"
    move = 0
    ns = parse_arguments()
    scripts = ns.competing_scripts
    _check_scripts(scripts)

    if len(scripts) == 1:
        script = scripts[0]
    # TODO: create a tree to make all the scripts compete together

    while True:
        if ns.mode == 'stdin':
            state = _run_in_stdin(script, state)

        elif ns.mode == 'arg':
            state = _run_as_arg(script, state)

        board = Board.board_from_string(state)
        print("move %d:\n%s" % (move, str(board)))
        move += 1

        for sym in SYMBOLS:
            if board.winning(sym):
                other = SYMBOLS[(SYMBOLS.index(sym) + 1) % 2]
                print("symbol %s won" % other)
                exit(0)
def main():
    assert len(sys.argv) > 1, "you need to pass the board configuration"
    board = Board.board_from_string(sys.argv[1])
    player = Player(board.next_playing_symbol())
    print(player.next_board(board))
def test_board():
    state = "---------"
    assert list(Board.board_from_string(state).iter_blank_cells()) == [(0, 0), (0, 1), (0, 2), (1, 0), (1, 1), (1, 2), (2, 0), (2, 1), (2, 2)]
    state = "xxxxxxxx-"
    assert list(Board.board_from_string(state).iter_blank_cells()) == [(2, 2)]