Skip to content

ahmedsameha1/snake_game_racket

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Snake Game

A classic implementation of the Snake game built using the Racket programming language. This project was created as a solution to the Build Your Own Snake Game coding challenge.

📖 About

This project demonstrates functional game programming concepts using Racket's 2htdp/universe engine. It features a snake that grows as it consumes food (represented by a rat), collision detection, and score tracking.

Key Libraries Used:

  • 2htdp/universe: For the game engine and world state management.
  • 2htdp/image: For creating and handling game graphics.
  • lang/posn: For coordinate and position management.
  • rackunit: For unit testing game logic.

⚙️ Prerequisites

To run this game, you need to have DrRacket installed on your machine.

🚀 Getting Started

1. Clone the Repository

Open your terminal and run the following command to clone the project:

git clone [https://github.com/ahmedsameha1/snake_game_racket.git](https://github.com/ahmedsameha1/snake_game_racket.git)

2. Run the Game

  1. Open the DrRacket IDE (installed with Racket).
  2. Open the ccsnake.rkt file from the cloned repository.
  3. Click the Run button in the toolbar (or press Ctrl+R / Cmd+R).
  4. The game window should appear automatically.

This is my implementaion of the Snake game. It is written using Racket programming language. I used 2htdp/image to create and handle images. I used 2htdp/universe as the game engine. I used lang/posn to position images. I used rackunit for testing.

🎮 Controls

Use the keyboard to control the snake:

Key Action
⬆️ Up Arrow Move Up
⬇️ Down Arrow Move Down
⬅️ Left Arrow Move Left
➡️ Right Arrow Move Right

🧪 Running Tests

This project includes unit tests to ensure game logic (like movement and growth) works correctly.

  1. Open ccsnake_test.rkt in DrRacket.
  2. Click the Run button.
  3. DrRacket will execute the tests defined with rackunit and report any failures in the interactions window.

👏 Acknowledgments

About

The Snake game using Racket programming language

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages