libwordle
Open this project in 8bitworkshop.
This is a C library for making Wordle-like games for 8-bit systems.
Platforms supported:
- C64 (cc65)
Wordle is a game by Josh Wardle.
Example
#include "libwordle.h"
void play(void) {
char buf[6];
int iter = 1;
int i, result;
libwordle_initindex(&w, ((unsigned int)rand()) % NUMWORDS);
printf("Word is: %s\n", w.target);
do {
printf("\nGuess %d: ", iter);
gets(buf);
for (i=0; i<5; i++) {
buf[i] = toupper(buf[i]);
}
result = libwordle_update(&w, buf);
if (result == 0) continue;
if (result == 2) break;
} while (++iter <= 7);
}
Technical Info
The test program takes about 24 KB, which includes:
- 1.5 KB for the library code
- 18 KB for the dictionary
Uncomment #define LIBWORDLE_SMALLANDSLOW
to save 4 KB but make dictionary checks really really slow.