A deep learning AI that learns to find optimal abbreviated wheels (covered sets) for lottery combinations using neural networks and CUDA acceleration. Features a beautiful, streaming-friendly visualization perfect for YouTube and TikTok content.
An abbreviated wheel (also called a covered set or lottery wheel) guarantees that at least one ticket matches a minimum number of drawn numbers, no matter what combination is drawn.
This notation means:
- Pool (36): Choose from 36 total numbers
- Pick (5): Each ticket has 5 numbers
- Match (3): Guarantee at least 3 matching numbers
So if you play this wheel and the lottery draws ANY 5 numbers from 1-36, at least one of your tickets will have 3+ matching numbers!
| Wheel | Pool | Pick | Match | Typical Tickets |
|---|---|---|---|---|
| 3/5/36 | 36 | 5 | 3 | ~15-25 |
| 4/6/49 | 49 | 6 | 4 | ~50-100 |
| 3/6/45 | 45 | 6 | 3 | ~20-40 |
| 5/6/49 | 49 | 6 | 5 | ~200+ |
The AI learns to find the minimum number of tickets needed to guarantee coverage!
- π§ Neural Network Learning: Transformer-based architecture that learns optimal ticket selection
- π CUDA Acceleration: Leverages NVIDIA GPU for fast coverage calculations
- π Beautiful Visualization: Streaming-ready interface with real-time animations
- π Hybrid Training: Combines greedy search with reinforcement learning
- π Live Statistics: Watch the AI improve in real-time
- π¨ Cyberpunk Theme: Neon-styled UI perfect for content creation
- Python 3.8+
- NVIDIA GPU with CUDA support (recommended: RTX 3060 or better)
- PyTorch with CUDA
- Pygame for visualization
# Clone the repository
git clone https://github.com/yourusername/Covered-Set-Learner.git
cd Covered-Set-Learner
# Install dependencies
pip install -r requirements.txt
# For CUDA support, install PyTorch with CUDA:
# Visit https://pytorch.org/get-started/locally/ for your specific setup
pip install torch torchvision --index-url https://download.pytorch.org/whl/cu118python main.pyThis launches the full visual experience with:
- Real-time neural network training
- Animated number grid
- Live coverage progress
- Streaming-ready interface (1280x720)
python main.py --headless# 3 of 5 from 36 (default)
python main.py --pool 36 --draw 5 --match 3
# 4 of 6 from 49 (like many national lotteries)
python main.py --pool 49 --draw 6 --match 4
# 3 of 6 from 45
python main.py --pool 45 --draw 6 --match 3
# More training generations
python main.py --gens 1000
# Different training modes
python main.py --mode rl # Pure reinforcement learning
python main.py --mode greedy # Greedy exploration
python main.py --mode hybrid # Combined (default)python main.py --help
Options:
--pool INT Lottery pool size (default: 36)
--draw INT Numbers per draw (default: 5)
--match INT Minimum matches required (default: 3)
--target FLOAT Target coverage percentage (default: 100)
--gens INT Number of generations (default: 500)
--mode Training mode: greedy, rl, hybrid (default: hybrid)
--headless Run without visualization
--seed INT Random seed for reproducibility
The visualization is designed for streaming:
- Resolution: 1280x720 by default (modify in
visualization.py) - FPS: Capped at 60 FPS for smooth streaming
- Color Theme: Cyberpunk/neon colors optimized for video compression
- Use Window Capture for the pygame window
- Add a slight blur to reduce encoding artifacts
- Consider adding a webcam overlay in the corner
- Covered Set Calculator: GPU-accelerated coverage computation
- Neural Network: Transformer-based ticket generator
- Training Loop: Hybrid reinforcement learning + greedy exploration
- Visualization: Real-time pygame interface
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β TRAINING LOOP β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β 1. Neural network observes uncovered combinations β
β 2. Generates probability distribution over numbers β
β 3. Samples a new ticket based on probabilities β
β 4. Calculates coverage improvement (reward) β
β 5. Updates network weights via policy gradients β
β 6. Repeats until target coverage achieved β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
- TicketGenerator: Transformer encoder that learns number relationships
- CoveredSetPolicy: Wraps the generator with state management
- ReinforcementTrainer: Policy gradient training with returns
- CoveredSetCalculator: Fast GPU-based coverage computation
On an NVIDIA RTX 3060:
| Configuration | Pool | Draw | Match | ~Min Tickets | Compute Time |
|---|---|---|---|---|---|
| Default | 36 | 5 | 3 | ~15-20 | <1 min |
| Larger | 45 | 6 | 3 | ~30-50 | ~2 min |
| Hard | 49 | 6 | 4 | ~100+ | ~5 min |
- Number Grid: Shows all pool numbers with heat map coloring
- Progress Bar: Animated coverage progress with glow effects
- Stats Panel: Real-time training statistics and mini-graph
- Ticket Display: Scrollable list of generated tickets
- Neural Network Viz: Animated network activity display
- Particle Effects: Celebration particles on improvements
Covered-Set-Learner/
βββ main.py # Entry point and training orchestration
βββ covered_set.py # Coverage calculation (CUDA-accelerated)
βββ neural_network.py # Neural network architecture
βββ visualization.py # Streaming-friendly pygame interface
βββ requirements.txt # Python dependencies
βββ README.md # This file
The covered set problem is related to covering designs in combinatorics:
- A covering design C(v, k, t) covers all t-subsets of v elements using k-subsets
- Finding optimal covers is NP-hard
- Our neural network approximates good solutions through learning
Theoretical lower bound (SchΓΆnheim bound):
L(n, k, m) β₯ β(n/k) Γ β((n-1)/(k-1)) Γ ... β((n-m+1)/(k-m+1))β...ββ
Contributions welcome! Areas for improvement:
- Add more neural network architectures
- Implement evolutionary strategies
- Add support for different lottery types
- Improve visualization with more effects
- Add training checkpoints/resume
MIT License - Feel free to use for content creation!
- PyTorch team for the deep learning framework
- Pygame community for the visualization library
- Covered set research by various mathematicians
Made with π§ and π° for content creators and math enthusiasts!