How to Add the Game AI Visualizer to Your Website
LK Forge · 4 min read · Updated September 2026
You can add the Game AI Visualizer to any website, blog, or classroom page with a single line of code — free, with no sign-up, no plugin, and no script to install. It runs three of the classic algorithms behind game AI, live and watchable: minimax with alpha-beta pruning, expectimax, and breadth-first search. This guide covers the fastest way to embed the tool, what it shows, and where it works.
The quickest way: paste one embed snippet
An embed is just an <iframe> that loads the visualizer from lkforge.com, plus a small credit line. Copy this into your page’s HTML where you want the widget to appear:
<iframe src="https://lkforge.com/embed/game-ai-visualizer/"
width="100%" height="740" loading="lazy"
style="border:0;max-width:620px"
title="Game AI Visualizer by LK Forge"></iframe>
<p><a href="https://lkforge.com/tools/game-ai-visualizer/">Game AI Visualizer</a>
by <a href="https://lkforge.com/">LK Forge</a></p> The <iframe> is the live tool; the <p> underneath is a plain credit link. Keep that line — the visible link is what keeps the widget free to embed. You can also copy this exact code straight from the LK Forge widget gallery.
What the widget shows
Three tabs, three algorithms, each interactive:
- Minimax + alpha-beta: play Tic-Tac-Toe against an opponent that searches the whole game tree — unbeatable — and watch the position count, including how many branches alpha-beta pruning skips.
- Expectimax: slide a turn total and see a chance node average the six faces of a die, the same idea 2048 uses for its random tile spawns. The recommendation flips from roll to hold at exactly 20.
- Breadth-first search: draw walls on a grid, run BFS, and watch the frontier expand ring by ring until it finds a shortest path from start to goal.
Pick the right height
The snippet uses height="740", which fits the tabs, the tallest panel (the BFS grid) and the controls without clipping even on a narrow phone, where the layout stacks into one column. On a wider page the widget centres within its max-width:620px. That single height works across screen sizes, so there is nothing to tweak for mobile.
Where it works
Because it is a standard iframe, the embed works anywhere you can add HTML:
- WordPress: add a Custom HTML block and paste the snippet.
- Squarespace: use a Code / Embed block.
- Wix: add an Embed HTML / iframe element.
- Ghost: insert an HTML card.
- Notion: paste the
/embed/game-ai-visualizer/URL and choose "Create embed". - Plain HTML, an intranet, or a lesson page: paste the snippet straight into the markup.
That’s the whole job. Copy the embed code from the widget gallery and paste it wherever a lesson or a blog post on game AI, search algorithms or why classic games don’t need a language model wants a demo students can actually play with.
Grab the embed code from the LK Forge widget gallery — free, no sign-up.
Open the Game AI VisualizerFrequently asked questions
- What can visitors do with the embedded visualizer?
- They can switch between three algorithms with the tabs. In Minimax they play Tic-Tac-Toe against an unbeatable opponent and watch how many positions it evaluated and how many alpha-beta pruning skipped. In Expectimax they slide a turn total and see a chance node average the six outcomes of a die, which reveals the classic "hold at 20" rule. In BFS they draw walls on a grid, run breadth-first search, and watch the frontier expand to a shortest path. Everything runs in the visitor’s browser.
- Is this a language model, or real algorithms?
- Real algorithms. Nothing calls an AI model or a server — the page runs minimax with alpha-beta pruning, expectimax over a chance node, and breadth-first search directly in JavaScript on the visitor’s device. That is the point of the widget: it shows the actual game-tree and graph search behind classic game AI, not a chatbot dressed up as one.
- What iframe height should I use, especially on mobile?
- The snippet ships with height="740", which fits the tabs, the tallest panel (the BFS grid) and the controls without clipping, including on a narrow phone where the layout stacks into one column. On a wider page the widget centres within its max-width of 620px, so the same height works across screen sizes.
- Does it send any data or need an account?
- No. There is no sign-up and nothing is uploaded — the visualizer is entirely client-side, so a visitor’s moves and drawn walls never leave their browser. The only request the iframe makes is to load the widget itself from lkforge.com.