This is a simple implementation of the classic Snake game using Ruby. The game is played in the terminal, and the objective is to control the snake to eat the food and grow as long as possible without hitting the walls or itself.
- Make sure you have Ruby installed on your system.
- Clone this repository to your local machine.
- Navigate to the project directory.
To start the game, run the following command in your terminal: Use the arrow keys (up, down, left, right) to control the snake's movement. The game will continue until the snake hits a wall or itself. After the game ends, you can choose to play again or exit.
You can customize the game by modifying the following parameters in the snake_game.rb
file:
BOARD_WIDTH
andBOARD_HEIGHT
: Set the size of the game board.INITIAL_SNAKE_LENGTH
: Set the initial length of the snake.SNAKE_SPEED
: Set the speed of the snake's movement.SNAKE_BODY_CHAR
andSNAKE_HEAD_CHAR
: Customize the appearance of the snake on the board.FOOD_CHAR
: Customize the appearance of the food on the board.
Feel free to experiment and make changes to enhance your game!
If you'd like to contribute to this project, you can fork the repository, make your changes, and submit a pull request. Contributions are always welcome!