Treasure Hunt Agent Game

Train an intelligent explorer, shape rewards, avoid dangerous traps, collect every treasure, compare policies, and master efficient reinforcement learning through animated experiments and challenges.

Live mission dashboard
Train, test, replay, and compare a treasure-seeking reinforcement learning agent.
Training mode Q-learning Generated 2026-08-10 16:59:43
Episode0
Episode reward0
Treasures0 / 0
Steps0
Trap hits0
Success rate0%
Agent and training controls
Keyboard: arrows or WASD. Space performs one learned step.
Ready0%
Interactive treasure map
Click cells while map editing is enabled. Toggle policy arrows and state values below.
Reward 0 No timer
Agent Treasure Trap Wall Water Teleporter Exit Visited
Advanced maps hide unscanned traps. Find a key before disarming one.
Map builder
Mission log
Reward configuration
Reward shaping changes what the agent learns. Use balanced values to encourage safe, efficient routes.
Current balance favours treasure collection while discouraging traps and unnecessary movement.
Plotly learning analytics
Policy metrics
Average reward0.00
Best reward0.00
Average steps0.00
Policy efficiency0%
Exploration35%
Q-value change0.000
Best route length
Shortest-path gap
Learned policy snapshot
Learning challenges
0 / 8
Achievements
Save, compare, and export
Run a comparison to measure how much the trained policy improves over random movement.
Local high scores
RankRewardStepsModeDate
Complete a successful mission to record a score.
How the agent learns
States, actions, and rewards

Each grid position is a state. The agent chooses a movement action and receives a reward. It learns which choices produce valuable long-term outcomes.

Q-learning update

Q(s,a) ← Q(s,a) + α[r + γ max Q(s′,a′) − Q(s,a)]. Learning rate α controls update size. Discount factor γ controls future reward importance.

SARSA update

SARSA updates using the next action actually selected by the policy. It often learns more cautious behaviour when exploration can trigger traps.

Exploration versus exploitation

Exploration tries uncertain actions. Exploitation chooses the best-known action. Epsilon-greedy balances both and gradually reduces exploration through decay.

Reward shaping guidance

Large treasure rewards motivate collection. Move costs encourage shorter routes. Strong trap penalties improve safety but can make the policy overly cautious.

Related Calculators

Maze Learning AgentGrid World ExplorerRobot Navigation ChallengeTraffic Light ControllerMulti-Armed Bandit GameCart Balancing ChallengeEnergy Management AgentWarehouse Robot GameAdaptive Game Opponent

Important Note: All the Calculators listed in this site are for educational purpose only and we do not guarentee the accuracy of results. Please do consult with other sources as well.