I made a NIM game using nginx.
You can easily host the game.
When you send a request, the counter increments. If you send requests too quickly, you will be rate limited.
The user who increment the 100th counter wins.
It's a kind of mathematical mind game where a set number of stones are taken, and the last player to take the last stone wins or loses. (In this game, the last player to take the last stone wins)
- Each user can increment the server's counter by 1 using the curl command.
- Each user can send upto 1 request per second (to prevent repeated counting).
- The first user to make the 100th request wins.
curl http://GAME_HOST_IP/count
echo "SECRET_PRIZE_CODE" > prize.txt # create new prize code
cat prize.txt | md5sum # check the md5 hash
docker run -d --platform=linux/amd64 --network host -v $(pwd)/prize.txt:/usr/local/etc/nginx/prize.txt ghcr.io/roeniss/nim-game-with-nginx:latest
Warning
Only Linux docker can transfer user's real ip. Other platform (Windows, macOS) will show 127.0.0.1 or something like that, so all users will share the rate limiter (which is another fun game).
- When a request comes in to nginx, a handler written in perl take the request and send a response to client.
- The perl module uses sqlite3 to update the counter.
There is no automated installation, but you can build your own using the files in this repository.