int diff
[20], i
, k
, m
, n
, best
, alts
;
if (strcmp(dobuff
, "bye") == 0)
sprintf(s
, "../../%s/L%s", sname
, dobuff
);
printf("no such lesson\n");
sprintf(fnam
, "../../%s/L%s", sname
, level
);
fprintf(stderr
, "No script for lesson %s.\n", level
);
while (fgets(zb
, 200, f
)) {
if (strcmp(zb
, "#next")==0)
printf("Congratulations; you have finished this sequence.\n");
for(i
=0; fgets(s
, 50, f
); i
++) {
sscanf(s
, "%s %d", posslev
[i
], &diff
[i
]);
/* cycle through lessons from random start */
/* first try the current place, failing that back up to
last place there are untried alternatives (but only one backup) */
if (already(posslev
[m
],0)) continue;
if (abs(diff
[m
]-speed
) < abs(diff
[best
]-speed
))
/* lessons exhausted or missing */
printf("Sorry, there are no alternative lessons at this stage.\n");
printf("See someone for help.\n");
strcpy (dobuff
, posslev
[best
]);