/*
    File:               vpl_exp.c
    Author:             michael stevens
    Experiment:         Viewing position effect (letters in string)
                        Stevens & Grainger 2003, Xpt. 1

        Experiment

            Instructions
            practice trials with tracking procedure
                that determines stimulus time
            Instructions
            Experimental trials
                short break after every 150 trials
            Close
*/

// include functions from vpl_trial.c
#define VPL_EXP_C
#include "vpl_trial.c"


// get session information
int subj;
int slen;

void info()
{
    int x;

    // string length
    do {
        ts_clrscr();
        x = ts_printf(-ax(.9), ay(.9), "String length (5/7): ");
        ts_scanf(-ax(.9) + x, ay(.9), "%d", &slen);
    } while (slen != 5 && slen != 7);

    // subject
    int smax;
    if (slen == 5)
        smax = 11;
    else
        smax = 23;
    do {
        ts_clrscr();
        x = ts_printf(-ax(.9), ay(.9), "Participant (0-%d): ", smax);
        ts_scanf(-ax(.9) + x, ay(.9), "%d", &subj);
    } while (subj < 0 || subj > smax);
    ts_clrscr();
}

void instructions1()
{
    ts_clrscr();
    ts_printf_centre(0, 0, "Type in the letter that appeared");
    ts_printf_centre(0, -ay(.25), "(space = I didn't see anything)");
    ts_button(0, -ay(.5));
    ts_clrscr();
}


void instructions2()
{
    ts_clrscr();
    ts_printf_centre(0, 0, "And now for real ...");
    ts_button(0, -ay(.5));
    ts_clrscr();
}

void short_break()
{
    ts_clrscr();
    ts_printf_centre(0, 0, "Break");
    ts_button(0, -ay(.5));
    ts_clrscr();
}


void bye()
{
    ts_clrscr();
    ts_printf_centre(0, 0, "That's all. Thanks");
    ts_button(0, -ay(.5));
    ts_clrscr();
}



// main function that runs the whole experiment
int main()
{
    // set screen parameters
    ts_refreshrate(60);
    ts_scrsize(XGA);
    ts_scrmode(FULLSCREEN);
    ts_font(COURIER, 20, BOLD);
    ts_textmode(BLACK);

    // activate response keys
    ts_defkey(KEY_B);
    ts_defkey(KEY_C);
    ts_defkey(KEY_D);
    ts_defkey(KEY_F);
    ts_defkey(KEY_H);
    ts_defkey(KEY_G);
    ts_defkey(KEY_J);
    ts_defkey(KEY_K);
    ts_defkey(KEY_L);
    ts_defkey(KEY_M);
    ts_defkey(KEY_N);
    ts_defkey(KEY_P);
    ts_defkey(KEY_R);
    ts_defkey(KEY_S);
    ts_defkey(KEY_T);
    ts_defkey(KEY_SPACE);
    ts_defkey(KEY_ESC);

    // get session info and randomize list
    info();
    randomize(subj, slen);

    // determine n of trials
    int ntrials;
    if (data[0].slen == FIVE)
        ntrials = NTRIALSPRACT + NTRIALS5;
    else
        ntrials = NTRIALSPRACT + NTRIALS7;

    // practice trials
    instructions1();
    int i;
    for (i = 0; i < NTRIALSPRACT; i++) {
        if (i < NTRIALSPRACT && i != 0 && i % CELLSPRACT == 0)
            if (adjust_stime(i) == STOP)
                break;
        trial(i);
    }

    // experimental trials
    instructions2();
    for (; i < ntrials; i++) {
        if (i > NTRIALSPRACT && (i - NTRIALSPRACT) % 150 == 0)
            short_break();
        trial(i);

    }

    // write data and exit
    writedata();
    bye();
    return 0;
}

END_OF_MAIN();


top
Persoonlijke pagina Universiteit GentTscope
Allegro | Cygwin | Gcc
© See license.html for copyright information