A Snake game implementation written in Java.
The goal is to feed the snake with apples, the red dots that appears randomly during the game play.
Snake must be kept in the board limits and must not collide with itself. Failure to keep those constraints cause the game to end.
Use the arrows keys (↑, →, ↓, ←) to navigate the snake up, right, down and left.
Press F2 to pause.
- Java JDK 17+
- Maven 3.8.4+
Clone this repository and compile it:
git clone https://github.com/thiagomfsup/snake-2d.git
cd snake-2d
mvn package
An executable Jar file will be created. Double-click on it or execute the following command to start playing:
java -jar ./target/snake-2d-1.0-SNAPSHOT.jar
- Tania Rascia's Writing a Snake Game for the Terminal in JavaScript blog for the initial inspiration.
- Google's Snake as a source of ideas for game improvements.
- Leonel Gayard for reviewing the code and give me some code improvement suggestions.
This project is licensed under the MIT License - see the LICENSE file for details