def track(exp):
    """ The tracking function
    """
    exp.var.dynamic['values'].append(exp.var.dynamic['value'])
    if exp.var.dynamic['cur_correct']:
        exp.var.dynamic['cur_dns'] += 1
        exp.var.dynamic['cur_ups'] = 0
        if exp.var.dynamic['cur_dns'] == exp.var.dynamic['downs']:
            exp.var.dynamic['cur_step'] = -1
            exp.var.dynamic['cur_dns'] = 0
            if exp.var.dynamic['prev_dir'] == -1:
                exp.var.dynamic['track'].append(0)
                exp.var.dynamic['cur_status'] = ' '
            elif exp.var.dynamic['prev_dir'] == 0:
                exp.var.dynamic['prev_dir'] = -1
                exp.var.dynamic['track'].append(0)
                exp.var.dynamic['init_dir'] = -1
                exp.var.dynamic['cur_status'] = 'v'
            else:
                exp.var.dynamic['prev_dir'] = -1
                exp.var.dynamic['track'].append(-1)
                exp.var.dynamic['n_reversals'] += 1
                exp.var.dynamic['values_at_rev'].append(exp.var.dynamic[
                    'value'])
                exp.var.dynamic['cur_status'] = '-{:}'.format(len(exp.var.
                    dynamic['values_at_rev']))
        else:
            exp.var.dynamic['cur_step'] = 0
            exp.var.dynamic['track'].append(0)
            exp.var.dynamic['cur_status'] = ' '
    else:
        exp.var.dynamic['cur_dns'] = 0
        exp.var.dynamic['cur_ups'] += 1
        if exp.var.dynamic['cur_ups'] == exp.var.dynamic['ups']:
            exp.var.dynamic['cur_step'] = 1
            exp.var.dynamic['cur_ups'] = 0
            if exp.var.dynamic['prev_dir'] == 1:
                exp.var.dynamic['track'].append(0)
                exp.var.dynamic['cur_status'] = ' '
            elif exp.var.dynamic['prev_dir'] == 0:
                exp.var.dynamic['prev_dir'] = 1
                exp.var.dynamic['track'].append(0)
                exp.var.dynamic['init_dir'] = 1
                exp.var.dynamic['cur_status'] = '^'
            else:
                exp.var.dynamic['prev_dir'] = 1
                exp.var.dynamic['track'].append(1)
                exp.var.dynamic['n_reversals'] += 1
                exp.var.dynamic['values_at_rev'].append(exp.var.dynamic[
                    'value'])
                exp.var.dynamic['cur_status'] = '+{:}'.format(len(exp.var.
                    dynamic['values_at_rev']))
        else:
            exp.var.dynamic['cur_step'] = 0
            exp.var.dynamic['track'].append(0)
            exp.var.dynamic['cur_status'] = ' '
