A five-letter word-guessing game with a Dyalog APL backend served by Jarvis.
The entire demo, front end and back end, was generated by Claude. There were no manual
changes to the APL code (Source/Quadword.apln,
Tests/RunAll.apls, Demo3.apls) or to the HTML,
CSS and JavaScript (HTML/). The requirements it worked from
are in docs/plans/design.md.
From the demo3 folder (the script finds its files
relative to the current directory):
dyalogscript Demo3.aplsThen browse to http://localhost:8889. Press Ctrl+C to stop the
server. Server settings (port, code location, HTML folder, endpoints,
hooks) are in jarvisconfig.json; relative paths in it are
relative to the file’s folder. Set DYALOG_JARVIS_PORT to
override the port without editing the file.
The page loads its font from Google Fonts. Without internet access the game still works, using a fallback font.
From the demo3 folder:
dyalogscript Tests/RunAll.aplsIt prints PASS or FAIL for each test and exits with a non-zero code if any test fails.
| Path | Contents |
|---|---|
Demo3.apls |
Starts Jarvis using
jarvisconfig.json and keeps running until stopped |
Jarvis.dyalog |
Jarvis web service framework |
jarvisconfig.json |
Jarvis configuration |
Source/Quadword.apln |
Game logic, word list, endpoints and the SSE encouragement stream |
HTML/ |
Front end (index.html,
style.css, app.js) served by Jarvis’s HTML
interface |
Tests/RunAll.apls |
Unit tests for the game logic |
docs/plans/design.md |
The original requirements for the application |
All endpoints use HTTP POST with a JSON body, except
Encourage.
NewGame returns
{gameId, wordLength, maxGuesses}Guess with {gameId, guess} returns
{guess, score, status, guessNumber} where each
score item is 2 (right letter, right place), 1 (right
letter, wrong place) or 0 (not in the word), and status is
playing, won or lost. When the
game ends, answer and message are added. A
rejected guess returns {error}.GET /Encourage is a Server-Sent Events stream of
encourage events: a welcome message when you connect, then
a random encouraging message about every 30 seconds.The answer stays on the server until the game is over.
Try it from the command line:
curl -X POST -H 'Content-Type: application/json' -d '{}' http://localhost:8889/NewGame
curl -X POST -H 'Content-Type: application/json' -d '{"gameId":"<id from NewGame>","guess":"crane"}' http://localhost:8889/Guess
curl -N http://localhost:8889/Encourage