Snake Game in Java

This is a simple implementation of the classic Snake game using Java and the Swing library.

Table of Contents

Introduction

This project is a basic version of the Snake game where the player controls a snake to eat food, grow longer, and avoid colliding with the walls or itself. The game is implemented using Java and the Swing library for the graphical user interface.

Features

  • Grid-based game board
  • Snake grows longer when it eats food
  • Game over condition when the snake collides with the walls or itself
  • Simple score display

Installation

To run the Snake game, you need to have Java installed on your system. Follow these steps to set up and run the game:

Usage

Once the game is running, you can use the arrow keys to control the snake:

  • Up Arrow: Move up
  • Down Arrow: Move down
  • Left Arrow: Move left
  • Right Arrow: Move right

How to Play

  • The goal of the game is to eat the red food to grow longer.
  • Avoid running into the walls or the snake's own body.
  • The game ends when the snake collides with itself or the wall.
  • Your score is based on the length of the snake.