This project is an implementation of Chinese Chess (Xiangqi) with an AI opponent using Qt and C++.
- Graphical user interface for Chinese Chess
- Human vs Human gameplay
- Human vs AI gameplay
- AI vs AI gameplay
- Deep Q-Learning Network (DQN) based AI
- AI training functionality
- Save and load trained AI models
- Qt 6 or later
- C++17 compatible compiler
- CMake 3.16 or later
- Make sure you have Qt and CMake installed on your system.
- Clone this repository.
- Navigate to the project directory.
- Create a build directory:
mkdir build cd build
- Run CMake:
cmake .. # for Windows user, if you want to call your vs compiler in the command line window cmake .. -G "Visual Studio 17 2022" # change the 17 and 2022 to suit your situation
- Build the project:
cmake --build .
src/
: Contains the source filesinclude/
: Contains the header filesresources/
: Contains resource files (sounds, images)
How to Play
- Run the executable generated after building the project.
- Use the menu to select the game mode (Human vs Human, Human vs AI, or AI vs AI).
- Click on a piece to select it, then click on a valid destination to move the piece.
- The game ends when one player's General (King) is captured.
To train the AI:
- Go to the AI menu in the application.
- Select "Train AI" and input the number of training episodes.
- Wait for the training to complete.
- You can save the trained model using the "Save trained AI" option.