Skip to content

Latest commit

 

History

75 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Rush Hour AI Search Visualizer

This project is developed for the "Introduction to Artificial Intelligence" course at HCMUS. It provides an interactive visualization of classic AI search algorithms using the Rush Hour puzzle game.

Features

  • Interactive Visualization: Watch how different search algorithms solve Rush Hour puzzles in real time.
  • Multiple Algorithms: Includes implementations and visualizations for:
    • Breadth-First Search (BFS)
    • Depth-First Search (DFS)
    • Uniform-Cost Search (UCS)
    • A* Search
  • Performance Metrics: Displays search time, memory usage, and number of expanded nodes for each algorithm.
  • Step-by-Step Animation: See the current step count and total cost as the solution unfolds.
  • Multiple Maps: Try out various built-in Rush Hour puzzles of increasing difficulty.
  • User-Friendly Interface: Easily switch algorithms, reset puzzles, and navigate menus with keyboard or mouse.

Getting Started

Prerequisites

Installation

  1. Clone or Download the Repository

    git clone <repository-url>
    cd AI_search
    
  2. Install Dependencies

    pip install -r requirements.txt
    

    If you encounter issues with psutil or pygame, ensure you are using a compatible Python version.

  3. Prepare Assets

    Ensure the assets folder exists in the project directory and contains all required images and sound files:

    • Car and truck images (e.g., player.png, horizontal_car.png, vertical_truck.png, etc.)
    • Background images (e.g., map.png, background2.jpg)
    • Sound files (e.g., game-background.mp3, click.mp3, mouse-click.mp3)
    • Icon (traffic_icon.png)

    The game will not run correctly without these assets.

Running the Game

From the project root directory, run:

py source/main.py

or

python source/main.py

How to Play

  • Menu Navigation: Use arrow keys or WASD to move between menu options. Press Enter or click to select.
  • Algorithm Selection: Click the algorithm button or use left/right keys to switch between BFS, DFS, UCS, and A*.
  • Map Selection: Click the map button to cycle through different puzzles.
  • Play/Pause: Click the play/pause button or press P to start or pause the visualization.
  • Reset: Click the reset button or press R to restart the current puzzle.
  • Quit: Click the quit button or press Q to exit the game.

Project Structure

AI_search/
│
├── assets/                # Images and sound files (required)
├── source/
│   ├── main.py            # Main entry point and UI logic
│   ├── game.py            # Game logic and search algorithms
│   ├── map.py             # Puzzle definitions
│   ├── vehicle.py         # Vehicle and truck classes
│   ├── button.py          # Button UI component
│   ├── sound.py           # Sound management
│   └── font.py            # Font management
├── requirements.txt       # Python dependencies
├── README.md              # Project documentation
└── LICENSE                # MIT License

License

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


Enjoy visualizing AI search algorithms with Rush Hour!

About

Benchmark and Comparison on several searching algorithms including uninformed search and informed search. Visualization is presented through Rush Hour game. This is the first project in the course Introduction to Artificial Intelligence at HCMUS.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages