A cli-game written in Phel.
This repository contains a full-version and a simplified version of the snake game.
I thought it might be useful to create a simplified version as introduction to the fundamentals of the language and the game itself.
- In the simplified version, you will find just the snake inside the board.
- In the full version, the snake will increase the speed as it reaches to goals.
Use the arrow keys to move the snake: left-right-top-down
.
The game ends when the snake touches any border of the board.
-
You can use the
space-key
to accelerate a few cells the snake in the current direction. -
The snake will automatically increase the speed after each goal reached, unless you enable the "god mode" (using the argument
god-mode
).
- Clone this repo
- Build the image and run the container:
docker-compose up --build -d
- Run the game:
docker exec -it phel_snake ./tools/composer play
- Ensure you have PHP
>=8.2
- Clone this repo
- Install the dependencies:
./tools/composer install
- Run the game:
./tools/composer play
Alternatively, you can run the game using the phel run
command
You can define some optional arguments
- width={N} -> width of the board
- height={N} -> height of the board
- god-mode -> the snake won't increment the speed as it eats apples
- debug -> you can see internal stats of the game
- simple -> start the simplified game
vendor/bin/phel run src/main.phel width=40 height=15 god-mode debug