Official instructions to install the engine (but not the game) are available here: https://github.com/leanprover-community/lean4game/blob/main/doc/running_locally.md#manual-installation
However, to play the Natural Number Game, instead of installing the
template game GameSkeleton, you’ll need to install
nng4 from: https://github.com/leanprover-community/nng4
The following commands must be available in your PATH:
lake (Lean’s package manager)npm (Node.js package manager)gitNote: On Linux, the
lakecommand is typically installed in~/.elan/bin
Important: Both the game and engine must be installed in the same parent directory.
git clone https://github.com/leanprover-community/nng4.git
cd nng4
lake update -R
lake build
cd .. # Go back to the parent directorygit clone https://github.com/leanprover-community/lean4game.git
cd lean4game
npm install# Make sure you are in the lean4game directory
npm startThe URL should be: http://localhost:3000/#/g/local/nng4
All local games can be accessed by its folder name in the URL: http://localhost:3000/#/g/local/{game_folder}
Since the Natural Number Game is installed in the
nng4 directory (which must be side-by-side
to the lean4game directory), the URL is: http://localhost:3000/#/g/local/nng4
or execute this JavaScript code in the browser’s console:
{
const progress = localStorage.getItem('game_progress');
const newProgress = prompt('Current save (copy it or paste a new one):', progress);
if(newProgress) {
try {
JSON.parse(newProgress);
localStorage.setItem('game_progress', newProgress);
alert('Imported!');
} catch(e) {
alert('Invalid JSON!');
}
}
}