https://github.com/sehugg/libwordle
C library for Wordle-like games
https://github.com/sehugg/libwordle
Last synced: 10 days ago
JSON representation
C library for Wordle-like games
- Host: GitHub
- URL: https://github.com/sehugg/libwordle
- Owner: sehugg
- License: cc0-1.0
- Created: 2022-01-12T18:04:45.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2022-01-13T00:26:35.000Z (over 4 years ago)
- Last Synced: 2025-01-15T14:15:29.547Z (over 1 year ago)
- Language: C
- Size: 261 KB
- Stars: 4
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
libwordle
=====
[Open this project in 8bitworkshop](http://8bitworkshop.com/redir.html?platform=c64&githubURL=https%3A%2F%2Fgithub.com%2Fsehugg%2Flibwordle&file=libwordle.c).
This is a C library for making Wordle-like games for 8-bit systems.
Platforms supported:
* C64 (cc65)
[Wordle](https://www.powerlanguage.co.uk/wordle/) is a game by Josh Wardle.
## Example
```c
#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.