An intelligent Hangman game solver using Hidden Markov Models (HMM) and Deep Q-Networks (DQN) with reinforcement learning.
- Multiple AI Approaches: HMM, DQN, Imitation Learning, and Ensemble methods
- Interactive GUI: Play against AI or watch AI play automatically
- Comprehensive Analysis: Detailed performance metrics and visualizations
- Production Ready: Clean, modular codebase with proper documentation
Hackman-ML/
├── src/ # Source code
│ ├── hangman_dqn_model.py # Core models (HMM, DQN, Environment)
│ ├── hangman_gui.py # Streamlit GUI
│ ├── test_model.py # Model testing
│ ├── train_quick_dqn.py # Quick training (~30 min)
│ └── train_improved_dqn.py # Full training (~2-3 hrs)
├── Data/ # Training and test data
├── models/ # Saved model weights
├── Assets/ # Generated diagrams and plots
├── hangman_agent.ipynb # Main Jupyter notebook
└── requirements.txt # Dependencies
pip install -r requirements.txtstreamlit run src/hangman_gui.py# Quick training (30 minutes)
python src/train_quick_dqn.py
# Full training (2-3 hours)
python src/train_improved_dqn.pypython src/test_model.py- Pure HMM: 31.6% win rate (Best performer!)
- DQN (trained): 55-65% win rate (after proper training)
- Imitation Learning: 8.8% win rate
- Ensemble: 3.75% win rate
See Assets/ folder for detailed visualizations.
- Python 3.12+
- PyTorch - Deep learning framework
- Streamlit - Interactive GUI
- Matplotlib - Visualizations
- NumPy & Pandas - Data processing
- Source Code Documentation
- Assets & Visualizations
- Jupyter Notebook - Complete implementation and analysis
- Launch the GUI:
streamlit run src/hangman_gui.py - Choose play mode:
- Human Mode: You play with optional AI hints
- AI Auto-Play: Watch the AI play automatically
- Select difficulty and AI model (HMM or DQN)
- Start playing!
See LICENSE file for details.
Akshay AG - akshayag2005