Skip to content

ToddCostella/rush-hour

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

54 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Rush Hour Game

Description

Rush Hour is a fun and engaging logic puzzle game where players maneuver their cars to help the red car (Car X) escape the congested parking lot grid. The objective is to move other cars out of the way and navigate the red car to the exit square in as few moves as possible.

Background

I created this project primarily to see what the experience of writing some amount of code in NeoVim. The game itself is mildly interesting, just from a how would I implement an console based game in Python.

Gameplay Demonstration

Below is an animated demonstration of the game to give you a visual sense of how it works:

Gameplay Animation

Features

  • Interactive Game: Use keyboard commands to move the cars around the grid.
  • Multiple Puzzles: The game includes different pre-defined puzzles for varied levels of difficulty.
  • Color-Coded Cars: Each car has a specific color, enhancing visual appeal and indicating different cars.
  • Rich Console Display: Utilizes the rich library for a visually appealing terminal interface.
  • Real-time updates: The game provides real-time feedback on the state of the board as moves are made.

Installation

  1. Install uv (Universal Virtualenv) from the terminal using the following command:

    curl -LsSf <https://astral.sh/uv/install.sh> | sh
  2. Install gcc: One of the dependencies (getch) requires that gcc be installed.

     apt install gcc

Usage

To start playing the game, you can execute:

uv run app/main.py

Controls

  • Move Car X:

    • h: Move left
    • j: Move down
    • k: Move up
    • l: Move right
  • Select Car: Press the key corresponding to the car's ID (e.g., x, a, b for Cars X, A, B respectively) to select it before moving.

  • q: Quit the game.

Testing

The project comes with unit tests to validate the functionality of the game logic. To run the tests, execute:

uv run -m pytest

License

This project is licensed under the MIT License. See the LICENSE file for details.


Enjoy playing Rush Hour! May you guide Car X to victory! 🚗💨

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages