Downloads · 30 days
0
Qamro/Strategic-AI-for-Pokemon-TCG-Battle-Decision-Making
Strategic-AI-for-Pokemon-TCG-Battle-Decision-Making is a machine learning model from Qamro. Use it for the machine learning task on the model card, and read the license before you ship it in a product.
This project explores the use of artificial intelligence and strategic decision-making to tackle the Pokémon Trading Card Game AI Battle Challenge on Kaggle. The goal is an agent that analyzes the current game state a…
Downloads · 30 days
0
Access
Public
Updated Aug 29, 2026
Repo size
271 KB
Likes
2
Public
Click a slice to open those files.
.csv883 KB · 72%
From the Hugging Face model README
This project explores the use of artificial intelligence and strategic decision-making to tackle the Pokémon Trading Card Game AI Battle Challenge on Kaggle. The goal is an agent that analyzes the current game state and selects effective actions during a battle, adapting to different situations rather than relying on a fixed strategy.
pokemon-tcg-ai-battle/
├── pokemon_tcg_ai/
│ ├── game_state.py # GameState / Pokemon / PlayerBoard data model
│ ├── actions.py # Action space + legal_actions(state)
│ ├── evaluator.py # Heuristic scoring of states and actions
│ ├── agent.py # HeuristicAgent + MLAgent decision policies
│ ├── features.py # (state, action) -> numeric feature vector
│ ├── dataset_generator.py # Self-play simulator -> synthetic dataset
│ └── train_model.py # Baseline ML model trained on the dataset
├── demo.py # End-to-end usage example
├── requirements.txt
└── README.md
The workflow mirrors the strategy outlined for the challenge:
GameState captures active/bench
Pokémon, HP, energy, prizes, hand size, and turn context.legal_actions() enumerates
attacks (with an energy-cost check), retreats, energy attachment,
supporter plays, and bench development.evaluate_state() scores the overall board; score_action() scores
each candidate move (damage output, knockout/lethal bonuses, risk of
over-extending, tempo/setup value).HeuristicAgent.choose_action() ranks all legal actions and picks the
best-scoring one; explain_decision() prints the reasoning.evaluator.py combines multiple weighted factors into a single score:
This lets the agent balance short-term payoff (e.g., taking a knockout now) against long-term positioning (e.g., developing the bench and energy curve before committing to an all-in attack).
Since the real competition environment/rules engine may not be wired up
yet, dataset_generator.py ships a simplified self-play simulator
that produces a structurally realistic dataset:
HeuristicAgent (with a configurable random-action
rate) plays full games turn by turn.(state, action) pair, the immediate
reward, the change in heuristic board evaluation, and the eventual
game outcome.Run:
python -m pokemon_tcg_ai.dataset_generator
This produces pokemon_tcg_battle_dataset.csv (~6–7k rows from 500
simulated games by default).
To plug in the real competition environment instead of the
simplified simulator, implement game_state.from_raw_observation() and
replace _apply_action_simplified() in dataset_generator.py with calls
into the actual environment's step function - the agent, evaluator, and
feature code do not need to change.
train_model.py fits a GradientBoostingRegressor on the generated
dataset to predict action value directly from features, as a first
learnable step beyond the hand-tuned heuristic:
python -m pokemon_tcg_ai.train_model
On the bundled synthetic dataset this reaches R² ≈ 0.80 on held-out
data, with MLAgent able to load the trained model and use it in place
of the heuristic scorer.
pip install -r requirements.txt
python demo.py
demo.py builds a sample battle state, prints the agent's ranked
candidate actions and chosen move, then generates a small sample
dataset.
legal_actions() re-derives the
space fresh every turn.The heuristic agent produces sensible, explainable decisions (see
demo.py output) and the self-play simulator produces a usable labeled
dataset end-to-end. Natural next steps:
from_raw_observation().evaluate_state().WEIGHTS in evaluator.py or to
supersede them entirely with a learned value function.This project turns raw game-state information into ranked, explainable strategic decisions, and adapts those decisions as a battle progresses. It also ships a synthetic dataset and training pipeline so the same codebase can grow from a rule-based baseline into a learned agent as more game data becomes available.