Esempio n. 1
0
def task(which=False):
    global response, response_time

    actr.reset()
    alphabet = [
        "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N",
        "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"
    ]
    letter = actr.permute_list(alphabet)[0]
    alphabet = ["Z"] + alphabet

    if which == 'next' or which == 'previous':
        task = which
    elif actr.random(2) == 0:
        task = 'next'
    else:
        task = 'previous'

    time = 1500 + actr.random(1000)

    window = actr.open_exp_window("Simple task")

    actr.install_device(window)

    actr.add_command("pm-issues-response", respond_to_key_press,
                     "Perceptual-motor issues task response")
    actr.monitor_command("output-key", "pm-issues-response")

    actr.add_text_to_exp_window(window, letter, x=130, y=150)

    actr.add_command("pm-issue-display", display_prompt,
                     "Perceptual-motor issues task prompt display")

    actr.schedule_event_relative(time,
                                 "pm-issue-display",
                                 params=[window, task],
                                 time_in_ms=True)

    response = []
    response_time = False

    actr.run(10, True)

    actr.remove_command("pm-issue-display")
    actr.remove_command_monitor("output-key", "pm-issues-response")
    actr.remove_command("pm-issues-response")

    if (len(response) == 2 and response_time > time and response[0] == letter
            and ((task == 'next' and alphabet.index(response[0]) ==
                  (alphabet.index(response[1]) - 1)) or
                 (task == 'previous' and alphabet.index(response[0]) ==
                  (alphabet.index(response[1]) + 1)))):
        result = True
    else:
        result = False

    return [task, result]
Esempio n. 2
0
def present_next_trial():
    global task_state,start_time,val1,val2

    task_state = 'trial'
    actr.clear_exp_window(window)
    val1 = actr.random(4)
    val2 = actr.random(4)
    actr.add_text_to_exp_window(window, str(val1), x=10, y=50)
    actr.add_text_to_exp_window(window, str(val2), x=110, y=50)
    start_time = actr.get_time()
Esempio n. 3
0
def trial(onset_time):

    actr.reset()

    letters = actr.permute_list([
        "B", "C", "D", "F", "G", "H", "J", "K", "L", "M", "N", "P", "Q", "R",
        "S", "T", "V", "W", "X", "Y", "Z"
    ])
    answers = []
    row = actr.random(3)
    window = actr.open_exp_window("Sperling Experiment", visible=True)

    for i in range(3):
        for j in range(4):
            txt = letters[j + (i * 4)]
            if i == row:
                answers.append(txt)
            actr.add_text_to_exp_window(window,
                                        txt,
                                        x=(75 + (j * 50)),
                                        y=(100 + (i * 50)))

    actr.install_device(window)

    if row == 0:
        freq = 2000
    elif row == 1:
        freq = 1000
    else:
        freq = 500

    actr.new_tone_sound(freq, .5, onset_time)
    actr.schedule_event_relative(900 + actr.random(200),
                                 "clear-exp-window",
                                 params=[window],
                                 time_in_ms=True)

    global responses
    responses = []

    actr.add_command("sperling-response", respond_to_key_press,
                     "Sperling task key press response monitor")
    actr.monitor_command("output-key", "sperling-response")

    actr.run(30, True)

    actr.remove_command_monitor("output-key", "sperling-response")
    actr.remove_command("sperling-response")

    if show_responses:
        print("answers: %s" % answers)
        print("responses: %s" % responses)

    return (compute_score(answers))
Esempio n. 4
0
def present_choose():

    actr.goal_focus('initial-goal')

    if actr.random(1.0) < .6:
        answer = 'a'
    elif actr.random(1.0) > .5:
        answer = 'b'
    else:
        answer = None

    actr.schedule_event_relative(5,
                                 'utility-learning-issues-show-result',
                                 params=[answer],
                                 output='medium')
Esempio n. 5
0
def random_word():

    num=actr.random(total_count)

    for i in word_list:
        if i[0] > num:
            return(i[1:])
Esempio n. 6
0
def load_stacked_deck():
    c1 = 5 + actr.random(6)
    c2 = 7 + actr.random(4)
    if actr.random(1.0) > .5:
        c4 = 2
    else:
        c4 = 8
    if c4 == 2:
        c3 = 10
        c6 = 10
    else:
        c3 = 21 - (c1 + c2)
        c6 = 2
    c5 = 10

    return [c1, c2, c3, c4, c5, c6]
Esempio n. 7
0
def person():
    global response

    window = actr.open_exp_window("Choice Experiment", visible=True)

    actr.add_command("choice-response", respond_to_key_press,
                     "Choice task key response")
    actr.monitor_command("output-key", "choice-response")

    actr.add_text_to_exp_window(window, 'choose', x=50, y=100)

    response = ''

    while response == '':
        actr.process_events()

    actr.clear_exp_window(window)

    if actr.random(1.0) < .9:
        answer = 'heads'
    else:
        answer = 'tails'

    actr.add_text_to_exp_window(window, answer, x=50, y=100)

    start = actr.get_time(False)

    while (actr.get_time(False) - start) < 1000:
        actr.process_events()

    actr.remove_command_monitor("output-key", "choice-response")
    actr.remove_command("choice-response")

    return response
Esempio n. 8
0
def experiment(human=False):

    actr.reset()

    items = actr.permute_list([
        "B", "C", "D", "F", "G", "H", "J", "K", "L", "M", "N", "P", "Q", "R",
        "S", "T", "V", "W", "X", "Y", "Z"
    ])
    target = items[0]
    foil = items[1]
    window = actr.open_exp_window("Letter difference")
    text1 = foil
    text2 = foil
    text3 = foil
    index = actr.random(3)

    if index == 0:
        text1 = target
    elif index == 1:
        text2 = target
    else:
        text3 = target

    actr.add_text_to_exp_window(window, text1, x=125, y=75)
    actr.add_text_to_exp_window(window, text2, x=75, y=175)
    actr.add_text_to_exp_window(window, text3, x=175, y=175)

    actr.add_command("unit2-key-press", respond_to_key_press,
                     "Assignment 2 task output-key monitor")
    actr.monitor_command("output-key", "unit2-key-press")

    global response
    response = ''

    if human == True:
        while response == '':
            actr.process_events()

    else:
        actr.install_device(window)
        actr.run(10, True)

    actr.remove_command_monitor("output-key", "unit2-key-press")
    actr.remove_command("unit2-key-press")

    if response.lower() == target.lower():
        return True
    else:
        return False
Esempio n. 9
0
def regular_deck():
    return min(10, actr.random(13) + 1)