20 lines
740 B
C
20 lines
740 B
C
#ifndef QUIZ_H
|
|
#define QUIZ_H
|
|
#define STATE_COUNT 50
|
|
#define ANSWER_SIZE 40
|
|
typedef unsigned char U8;
|
|
typedef struct { const char *code; const char *name; const char *capital; } State;
|
|
extern const State states[50];
|
|
extern U8 order[50], options[4], question, score, corrections;
|
|
extern U8 answered[50], correct[50], corrected[50];
|
|
extern char responses[50][ANSWER_SIZE];
|
|
extern unsigned random_state;
|
|
void quiz_start(unsigned seed);
|
|
unsigned quiz_random(unsigned bound);
|
|
void quiz_options(U8 state);
|
|
void normalize(const char *in, char *out);
|
|
/* 2 exact/alias, 1 near, 0 wrong (including a different known capital). */
|
|
U8 classify(U8 state, const char *answer);
|
|
void quiz_record(U8 state, const char *answer, U8 right, U8 spelling);
|
|
#endif
|