Inspiration
As lifelong Pokémon fans, we've always wondered: who would win in a battle between Pikachu and Charizard? Pokémon has captivated millions with its combat system, where type advantages, base stats, weather conditions, and status effects all play crucial roles. We wanted to bring the power of machine learning to predict these epic battles with accuracy.
The inspiration came from a simple question: Can we teach a computer to understand the complex strategic layers of Pokémon battles? With the rise of hackathons and our fascination with both Pokémon and AI, we decided to combine these passions into a project that could predict battle outcomes with remarkable precision.
What it does
PokeOracle is a battle prediction system that forecasts the winner of Pokémon battles before they even begin. Users can:
- Create battle teams of up to 3 Pokémon per side from a roster of 30 selected Pokémon
- Fine-tune battle scenarios with weather effects (Sun, Rain, Sandstorm, Hail), terrain types (Electric, Grassy, Misty, Psychic), and battlefield hazards
- Receive instant predictions with confidence scores showing the probability of each team winning
- View detailed stat comparisons, type matchups, and battle probabilities through an engaging retro-style interface
The system achieves 99.93% test accuracy on realistic battle scenarios, making it a trustworthy tool for competitive Pokémon strategists and casual fans alike.
How we built it
1. Data Engineering Pipeline
We built a comprehensive dataset by generating 418,500 unique battle scenarios from:
- 30 diverse Pokémon with varying stats and types
- 435 unique Pokémon pair combinations
- 900 different condition combinations (weather × terrain × hazards × status effects)
- Complete base stats, type advantages, and strategic metadata
2. Machine Learning Model
Algorithm: Random Forest Classifier with optimised hyper-parameters
- Features: 28 engineered features including:
- Individual stats for both Pokémon (HP, Attack, Defense, Sp. Attack, Sp. Defense, Speed)
- Statistical differences between Pokémon
- Type advantage calculations (dual-type support)
- Categorical encoding for weather, status effects, terrain, and hazards
- Model Architecture:
- 100 decision trees
- Max depth of 20
- Careful regularisation to prevent overfitting
- Stratified train-test split for balanced evaluation
3. Backend API (Flask)
RESTful API built with Flask and Flask-CORS for cross-origin support:
/api/predict- Battle prediction endpoint supporting both single and team battles/api/pokemon- Complete Pokémon roster listing/api/pokemon/<name>- Individual Pokémon stats and metadata- Real-time feature engineering and encoding for incoming predictions
4. Frontend (HTML/CSS/JavaScript)
Retro-inspired web interface capturing the nostalgic Game Boy aesthetic:
- Drag-and-drop style Pokémon selection
- Intuitive drop-downs for weather, terrain, and hazards
- Animated Pokéball icons, confidence bars, and probability meters
- Real-time stat comparisons and type information
- Quick Pokémon lookup with filtering
5. Integration & Deployment
- Modular architecture separating training, prediction, and API layers
- Joblib serialisation for efficient model storage and loading
- CORS-enabled API for seamless frontend-backend communication
- Python HTTP server for local deployment
Challenges we ran into
Data Generation Complexity
Creating realistic battle scenarios required careful consideration of the interplay between all variables. We had to ensure:
- Balanced representation of all condition combinations
- Proper handling of dual-type Pokémon (some have one type, some have two)
- Logical consistency in feature combinations (e.g., not all combinations make sense)
Solution: We developed a systematic feature generation pipeline that created every valid combination while maintaining data integrity.
Overfitting Prevention
Initial models achieved 100% training accuracy but struggled with generalisation. The challenge was maintaining high accuracy without memorising the training data.
Solution: We implemented careful hyper-parameter tuning, reduced tree depth, and added regularisation parameters to create a robust model that generalises well to unseen scenarios.
Frontend-Backend Communication
Cross-origin resource sharing (CORS) issues initially blocked API calls from the frontend. Additionally, handling team battles required different data structures than single battles.
Solution: We configured Flask-CORS properly and created a unified API endpoint that handles both single battles and team battles with conditional logic.
Feature Engineering for Dual-Types
Calculating type advantages for dual-type Pokémon required special handling, as attacks hit both types and the damage modifiers interact complexly.
Solution: We built a custom type advantage calculator that evaluates attacks against both defender types and aggregates the total modifier correctly.
Model Serialisation and Deployment
Ensuring the trained model, label encoders, and feature specifications all loaded correctly in the API required careful path management and serialisation strategy.
Solution: We used consistent relative paths and saved all required components (model, encoders, feature columns) together in pickle format.
Accomplishments that we're proud of
Reaching 99.93% test accuracy on a complex multi-feature classification problem demonstrates that we successfully captured the strategic nuances of Pokémon battles.
Creating a nostalgic, pixel-perfect interface that captures the essence of classic Pokémon games while maintaining modern usability. The animated Pokéballs and retro colour scheme turned a functional tool into an experience.
Designing 28 meaningful features from base stats and battle conditions required deep understanding of both the problem domain and machine learning best practices. We're particularly proud of the type advantage calculation system.
Building a clean, modular system that separates concerns - data generation, model training, prediction logic, API, and frontend - makes the project maintainable and extensible.
The prediction system is lightning-fast, providing results in milliseconds thanks to efficient model architecture and optimised data structures.
Generating 418,500 high-quality, balanced training samples was a significant accomplishment that required careful planning and systematic execution.
What we learned
Machine Learning
- Gained comprehensive understanding of ensemble methods, feature importance analysis, and decision tree mechanics
- Learned how to extract meaningful features from domain knowledge (Pokémon stats, type advantages, battle conditions)
- Understood the importance of proper train-test splits, stratified sampling, and preventing overfitting in classification tasks
- Mastered Label Encoder usage and the importance of consistent encoding between training and inference
Software Engineering
- Created clean, intuitive endpoints following REST principles
- Separated concerns into distinct components (training, prediction, API, frontend) for maintainability
- Learned practical skills in serialising models, handling paths, and serving ML models through APIs
- Solved CORS challenges in web development
Domain Knowledge
- Deepened understanding of type advantages, stat calculations, weather effects, and strategic combat elements
- Discovered which features matter most (total stat difference, type advantage, status effects)
Collaboration & Problem-Solving
- Learned to trace issues from frontend → API → model → data
- Found the sweet spot between model sophistication and simplicity
- Prioritised usability and visual appeal alongside technical accuracy
What's next for PokéOracle
Next, we want to add way more Pokémon and include important mechanics like abilities and held items, so battles feel even closer to the real games. We also plan to move beyond one-click predictions and work toward simulated battles and simple strategy tips, turning PokeOracle into a tool that not only predicts winners but helps explain why.
Built With
- css3
- csv
- flask
- flask-cors
- git
- github
- html5
- javascript
- joblib
- numpy
- pandas
- python
- scikit-learn

Log in or sign up for Devpost to join the conversation.