Skip to content

Ahmedabbas75/AI-Project

Repository files navigation

Snake (1)

Snake Game

The player controls a long, thin creature, resembling a snake, which roams around on a bordered plane, picking up food (or some other item), trying to avoid hitting its own tail or the edges of the playing area. Each time the snake eats a piece of food, its tail grows longer, making the game increasingly difficult

Characteristics

The following are some basic rules followed by our implementation:

  1. Goal - the snake tries to eat as many apples as possible, within finite steps. The first priority for the snake is to not colliding itself while the second is to increase the score.

  2. There are four possible directions the snake can move: left, right, up and down However, because of the placement of its tail some directions may not be available. The most clear example is that the snake can never swap to an opposite direction i.e. left to right, up to down, etc.

  3. The snake grows by one unit when eating an food. The growth is immediately reflected by the gained length of the tail, i.e. the tip of the tail occupies the square on which the apple was.

  4. The board size is fixed to square.

  5. After an food is eaten by the snake, another food is placed randomly with uniform probability on one available squares of the board.

Game Flow-chart

Requirements

  1. Python.
  2. Pygame.
  3. Numpy.
  4. PyQt5.

How to execute game

  • MainWindow Run the Game.

Some screen

Why this Project

Project done under supervision of Prof. @Sara El-Metwally by :

@Ahmed Mohmmed abbas | section 2