An interpretation of the Pac-Man game, written in approximately 1K lines of purely functional code. It runs both in the browser and in the terminal.
The game is written in the Elm language and the Gren language, using the TUI library for the version that runs in the terminal.
Go to: https://lucamug.github.io/functional-pacman/
Execute:
git clone https://github.com/lucamug/functional-pacman/
cd functional-pacman
node docs/gren-pacman
The program requires Node.js v20 or later.
By pressing [B], you can display additional internal information on the side of the playing area.
Clone the repository:
git clone https://github.com/lucamug/functional-pacman/
cd functional-pacman
npm install
Several commands are available in the cmd
folder.
cmd/start-elm
Then point your browser to http://localhost:8003/.
The main file is Game.elm. This code is the same as Game.gren. They are kept in sync via a symlink. After editing any Elm file, the game in the browser will automatically hot-reload.
cmd/start-gren
This will compile and run the code in the terminal. [ESC] or [CTRL + C] to exit.
To format the Gren code
cmd/format-gren
Run
cmd/build
This will update the file in /docs/
. These files can be published via Github from "Settings > Pages > Deploy from a branch > main /docs".