Race an intelligent JavaScript agent through a randomized 8×8 maze and be the first to reach the X treasure. Every board guarantees a valid path from start to goal — no impossible mazes, no server required.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/apursley2012/treasure-hunt-game/llms.txt
Use this file to discover all available pages before exploring further.
Introduction
Learn what Treasure Hunt is, how the browser demo relates to the original AI project, and what makes it tick.
Quickstart
Get the game running locally in under two minutes with a single command.
How to Play
Move with arrow keys or WASD, pick a difficulty, and race the agent to the X treasure.
Game Mechanics
Understand the maze rules, reward system, difficulty modes, and randomized board generation.
What is Treasure Hunt?
Treasure Hunt is a browser-based game that pits you against an intelligent JavaScript agent in a race through an 8×8 maze. It was rebuilt from an original Python reinforcement-learning project — a deep Q-learning pirate agent that learned to navigate a maze through repeated training episodes. The browser demo preserves the core mechanics (maze structure, valid movement rules, reward-based scoring) and wraps them in a playable, GitHub Pages–hosted experience that needs no Python, no Keras, and no build step.Architecture
Three modular JS files — maze engine, agent logic, and UI layer.
Original AI Project
The deep Q-learning Python code this demo was built from.
Deployment
Deploy to GitHub Pages in four steps — no build command needed.
Key Features
Randomized mazes
Every new game generates a fresh 8×8 board using a carve-and-validate algorithm. The board is always solvable —
createRandomMaze() guarantees a valid path of at least 12 cells before returning.Intelligent agent
The
CompetitiveAgent uses BFS shortest-path to chase the treasure. Three difficulty modes (Easy / Medium / Hard) control its speed, hesitation rate, and how often it makes exploratory detours.Reward tracking
Move costs mirror the original deep Q-learning environment: +1.0 for reaching the treasure, −0.04 per valid step, −0.25 for revisiting a cell, −0.75 for hitting a wall.