#define VPL_EXP_C
#include "vpl_trial.c"
int subj;
int slen;
void info()
{
int x;
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);
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();
}
int main()
{
ts_refreshrate(60);
ts_scrsize(XGA);
ts_scrmode(FULLSCREEN);
ts_font(COURIER, 20, BOLD);
ts_textmode(BLACK);
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);
info();
randomize(subj, slen);
int ntrials;
if (data[0].slen == FIVE)
ntrials = NTRIALSPRACT + NTRIALS5;
else
ntrials = NTRIALSPRACT + NTRIALS7;
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);
}
instructions2();
for (; i < ntrials; i++) {
if (i > NTRIALSPRACT && (i - NTRIALSPRACT) % 150 == 0)
short_break();
trial(i);
}
writedata();
bye();
return 0;
}
END_OF_MAIN();