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.
- 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.
-
Clone or Download the Repository
git clone <repository-url> cd AI_search -
Install Dependencies
pip install -r requirements.txtIf you encounter issues with
psutilorpygame, ensure you are using a compatible Python version. -
Prepare Assets
Ensure the
assetsfolder 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.
- Car and truck images (e.g.,
From the project root directory, run:
py source/main.py
or
python source/main.py
- 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
Pto start or pause the visualization. - Reset: Click the reset button or press
Rto restart the current puzzle. - Quit: Click the quit button or press
Qto exit the game.
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
This project is licensed under the MIT License. See LICENSE for details.
Enjoy visualizing AI search algorithms with Rush Hour!