The system uses three evolutionary approaches to discover Blackjack playing strategies:
| Method | Description |
|---|---|
| Standard GP | Tree-based genetic programming with unconstrained search |
| Grammar GP | Grammar-guided GP using BNF constraints |
| True GE | Grammatical Evolution with integer genome → phenotype mapping |
Evolved strategies are decision trees that make hit/stand/double decisions based on:
- Player's hand value (2-21)
- Dealer's upcard (2-11)
- Soft hand status (usable Ace)
- Double-down availability
See DESIGN.md for architecture, EA features, and design decisions.
Prerequisites: Python 3.8+
git clone https://github.com/oisinosullivan9/Evolutionary-Algorithms.git
cd Evolutionary-Algorithms
pip install -r requirements.txtOptional: Install Graphviz for decision tree visualization (add to PATH during install).
cd project
# Standard GP
python main.py --method standard
# Grammar-Guided GP
python main.py --method grammar
# True Grammatical Evolution
python main.py --method ge| File | Description |
|---|---|
graphs/fitness_over_generations_{method}_run{N}.png |
Fitness progression plot |
graphs/complexity_vs_fitness_{method}_run{N}.png |
Tree size vs fitness |
graphs/{method}_best_strategy_tree.png |
Best strategy visualization |