Skip to content

Snake is a classic video game where a player controls a snake's head, eating apples that spawn in the game board and avoid colliding with the edges of the board, and the snake itself.

Notifications You must be signed in to change notification settings

aucsc450/MultithreadedSnake

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

45 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MultithreadedSnake

This repository consists of the code that was used to create a multi-threaded snake game. In the snake game, a player controls the snake's head, and must move it using the up, down, left and right arrow keys. If the snake's head collides with any part of the snake's body, or the borders of the game board, the game is over. The snake grows by eating an apple that randomly spawns in some position of the board.

Gameplay (x4 speedup)

snake-gameplay-trim_VaPDI1h1.mp4

Language & Libraries

  • Made with C/C++
  • Includes the Allegro 4.4.2 library (a game library for C/C++ programming and includes DirectX and OpenGL to support it)
  • Includes the Pthreads library for Windows

Multithreaded Aspects

  • Spawning the apple in a random location
  • Handling keyboard input
  • Ending the game abruptly when the ESC key is pressed
  • The main thread (includes the game loop in the play_game() method)

Attribution

About

Snake is a classic video game where a player controls a snake's head, eating apples that spawn in the game board and avoid colliding with the edges of the board, and the snake itself.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published