Shadow-Code is a feature-rich chess game that supports both local AI battles and online multiplayer. Play against a Deep Reinforcement Learning (DRL) agent trained from scratch or connect with friends over a real-time socket-based networkโall with an elegant Pygame-based interface and animated visuals.
-
โ Local Play vs AI
Play against a trained Deep Q-Network (DQN)-based DRL agent. -
๐ Online Multiplayer
Host or join real-time matches using TCP sockets. -
๐๏ธ Smooth Animations
Enjoy sliding piece animations for a polished experience. -
๐ Promotion Interface
Promote pawns with a clean graphical selection. -
๐ Sound Effects
Custom sounds for moves, captures, and promotions. -
๐ Move History Sidebar
Track your game progress with a live move list.
git clone https://github.com/MrTBK/Shadow-Code.git
cd Shadow-CodeInstall the required packages via pip:
pip install -r requirements.txtNote: Requires Python 3.8+ and PyTorch.
To start the game:
python main.py- Select Local from the menu.
- Play against a Deep Q-Learning agent trained on legal chess states.
- Select Online โ Host.
- Wait for an opponent to connect.
- Game starts automatically after connection.
- Select Online โ Join.
- Enter the IP address of the host machine.
- Connect and start playing.
Shadow-Code/
โโโ assets/ # Piece images & sound files
โโโ dqn.py # DQN agent definition and utilities
โโโ game.py # Game logic and rendering
โโโ interface.py # UI handling (board, promotion UI, sounds)
โโโ server.py # Socket-based networking
โโโ main.py # Entry point
โโโ README.md
โโโ requirements.txt
Our AI uses a Deep Q-Network with a flat board tensor input. Training code and logs are included in the project for reproducibility. If no dqn_checkpoint.pt exists, training can be resumed automatically.