DEV Community

Alexuias Nel
Alexuias Nel

Posted on

My First terminal program.

I am an0maly

This my first terminal program. This was a challenge to see how much I've
learned in the last 3 months. Why snake you may ask cause we all remember the first time playing snake the game it self is filled with excitement so i thought why not create game that is close to you and with that conclusion i create my first basic terminal game "snake".

Code for snake

The game Snake typically involves controlling a snake to eat food while avoiding collisions with itself and the walls. Here are some common components and logic that might be part of your code:

  • Game Loop: Continuously updates the game state, checks for user input, and renders the game.
  • Snake Representation: Often a list of coordinates representing the snake’s body segments.
  • Movement: Updates the snake’s position based on user input (e.g., arrow keys).
  • Food: Randomly placed on the grid, and when eaten, the snake grows.
  • Collision Detection: Checks if the snake collides with itself or the boundaries.
  • Score: Tracks the number of food items eaten.
  • Graphics: Uses libraries like Pygame for rendering the snake, food, and game area.

https://github.com/Alexuias/snake.py.git

Top comments (0)