def create_tmux_commands_auto(session, logdir, worker_running, game_i_at, subject_i_at):

    ''''''
    cmds_map = []

    if (game_i_at>=len(config.game_dic)):
        print('all done')
        print(s)

    base_cmd = [
        'CUDA_VISIBLE_DEVICES=', sys.executable, 'worker.py',
        '--log-dir', logdir, '--env-id', config.game_dic[game_i_at],
        '--num-workers', str(1)]

    cmds_map += [new_tmux_cmd(session, 'g-'+str(game_i_at)+'-s-'+str(subject_i_at)+'-ps', base_cmd + ["--job-name", "ps",
                                                                                                 "--subject", str(subject_i_at)])]

    base_cmd = [
        'CUDA_VISIBLE_DEVICES=', sys.executable, 'worker.py',
        '--log-dir', logdir,
        '--env-id', config.game_dic[game_i_at],
        '--num-workers', str(1)]
    cmds_map += [new_tmux_cmd(session,
                              'g-'+str(game_i_at)+'-s-'+str(subject_i_at)+'-w-0',
                              base_cmd + ["--job-name", "worker",
                                          "--task", str(0),
                                          "--subject", str(subject_i_at)])]

    '''created new worker, add worker_running'''
    print('a pair of ps_worker for game '+config.game_dic[game_i_at]+' subject '+str(subject_i_at)+' is created.')
    worker_running += 1

    subject_i_at += 1
    if subject_i_at >= config.num_subjects:
        game_i_at += 1
        subject_i_at = 0

    worker_running +=1

    '''see if cmd added'''
    if len(cmds_map) > 0:

        ''''''
        windows = [v[0] for v in cmds_map]
        cmds = []
        for w in windows:
            cmds += ["tmux new-window -t {} -n {}".format(session, w)]
        cmds += ["sleep 1"]
        for window, cmd in cmds_map:
            cmds += [cmd]

        '''excute cmds'''
        os.system("\n".join(cmds))

    return worker_running, game_i_at, subject_i_at