Block Jam Game: Rules, Strategy and How to Build One

By Arron R.12 min read
A block jam game is a grid puzzle where you slide colored blocks out through exits of the same color, clearing a jammed board. Plan from the exits backward. You

A block jam game is a grid puzzle where colored blocks are packed tightly onto a small board and your job is to slide each one out through an exit of the same color. The “jam” is the whole point: blocks sit in each other’s way, so the puzzle is working out the order that frees them. This guide covers how the genre plays, how to beat the levels that stump you, where people usually play it, and how to build your own version, either by hand in JavaScript or by describing it to an AI game engine.

What is a block jam game?

Strip away the bright colors and a block jam game is a cousin of the classic sliding-block puzzle. You get a rectangular grid, usually somewhere around 5x5 to 8x8 cells. On it sit blocks of different shapes: single squares, 1x2 bars, long 1x3 or 1x4 bars, L-shapes and bigger chunks. Around the edge of the grid are doors, colored openings in the wall. A red block can only leave through a red door, a blue block through a blue door, and so on.

Blocks move in straight lines along the grid and cannot pass through each other or through walls. Clear every block and you win the level. Titles in this space go by names like Color Block Jam, Block Jam 3D and Block Logic, and they differ in details, but the core loop is the same: look at a jammed board, find the move that opens a path, repeat.

One quick note on the name, since “jam” covers a lot of ground. The word means everything from fruit preserve to a traffic jam to a malfunction, as the Wikipedia disambiguation page for “jam” shows. Def Jam is a fighting game series, Kan Jam is a backyard disc game (we cover its scoring and setup here), and a game jam is a short game-making event. A block jam game is none of those: it is a puzzle about blocks stuck in a crowd.

How a block jam game plays: rules and level elements

The rules fit in a sentence, but the level elements are where the variety lives. Here is what you will run into in most versions.

The core rules

  • Blocks move along rows and columns. Depending on the game you drag a block, swipe it, or tap it and it slides until it hits something.
  • Blocks are solid. Nothing overlaps. A block stops when the next cell is taken.
  • Exits match colors. A block leaves the board only through a door of its own color.
  • Doors have a width. A door that spans two cells lets a block that is two cells wide on that side pass. A three-wide block cannot squeeze through it.
  • Clear the board to win. Some levels also cap your moves or run a timer.

Common level elements

ElementWhat it doesWhy it makes the puzzle harder
Long barsSpan three or four cells in one directionThey cut the board into lanes and block several routes at once
Fixed wallsCells that never moveThey remove escape space and create narrow corridors
Axis-locked blocksMove only horizontally or only verticallyYou lose half your options for that piece
Layered or frozen blocksNeed a condition (another block cleared, a counter hitting zero) before they moveThey force a specific order
Narrow doorsExits narrower than some blocksA block must approach from the side where it is thin enough to fit
Move limits or timersCap moves or secondsTrial and error stops working; you have to plan

The 3D-styled versions mostly change the presentation: chunky beveled blocks, a tilted camera, satisfying pop effects when a piece exits. The logic underneath is still a flat grid.

Diagram of a block jam puzzle showing the order in which three colored blocks exit through matching doors
Solve order matters: the yellow block frees the blue one, which frees the red one.

Tips for solving tricky block jam levels

Early levels teach the rules and late levels test planning. These habits carry you through most of them.

  1. Work backward from the doors. Before moving anything, ask: which block could leave right now if nothing were in its way? Then look at what is in its way. That obstacle is your first move, or the obstacle’s obstacle is.
  2. Find the block that frees the most space. Removing one long bar often opens two or three routes. A single square leaving rarely changes much.
  3. Never park in front of a door. Sliding a block in front of an exit that a different color needs is the most common way to soft-lock a level.
  4. Keep corridors clear. If the board has a one-cell-wide lane, treat it as a road, not a parking spot.
  5. Move long blocks early. They get harder to place as the board fills with your temporary moves.
  6. Count moves on limited levels. Plan the whole sequence before touching the board. One wasted shuffle can make a 20-move level unwinnable.
  7. Restart instead of digging. When the board feels worse than it started, a restart is usually faster than untangling it.

Reading a block jam game as a dependency chain (“blue needs yellow gone, red needs blue gone”) is the single biggest skill jump. Once you see the chain, the moves become obvious.

Where to play a block jam game: free and download options

The genre lives in two places. Browser versions run on puzzle portals with no install, which is handy for a quick session on a work laptop. Mobile versions on the Android and iOS stores add progression systems, daily challenges and hundreds of levels. Most are free to start and are typically funded by ads or optional purchases such as hints, extra moves or ad removal, so read the store listing before you install.

If you are a developer, there is a third option: build your own. A block jam game is one of the best first puzzle projects there is. The rules are small, the art can be colored rectangles, and it teaches grid logic, collision and level design, the same skills behind most indie games made by solo developers and small teams. The next two sections show two ways to do it.

How to make a block jam game in JavaScript

Here is a complete, playable prototype in plain JavaScript and an HTML canvas. No framework needed. Click a block to select it, then use the arrow keys to move it one cell at a time. Push a block into a door of its color and it leaves the board.

The data model is the important part. Each block is a rectangle on the grid (x, y, width, height, color). Each door is a side of the board plus a range of cells and a color. Every move becomes one question: does the block’s next position overlap anything, and if it leaves the board, is there a matching door wide enough?

<canvas id="game" width="416" height="416"></canvas>
<p id="status">Moves: 0</p>
<script>
const COLS = 6, ROWS = 6, CELL = 64, PAD = 16;
const canvas = document.getElementById("game");
const ctx = canvas.getContext("2d");
const status = document.getElementById("status");

// A solvable level: yellow frees blue, blue frees red.
const blocks = [
  { color: "#f5c542", x: 2, y: 0, w: 2, h: 1 },
  { color: "#4a8cff", x: 3, y: 1, w: 1, h: 3 },
  { color: "#ff4d5e", x: 0, y: 2, w: 2, h: 1 },
  { color: "#3ccf7a", x: 0, y: 4, w: 2, h: 2 }
];
const doors = [
  { side: "left",   from: 0, to: 0, color: "#f5c542" },
  { side: "top",    from: 3, to: 3, color: "#4a8cff" },
  { side: "right",  from: 2, to: 2, color: "#ff4d5e" },
  { side: "bottom", from: 0, to: 1, color: "#3ccf7a" }
];
let selected = null, moves = 0;

function overlaps(a, b) {
  return a.x < b.x + b.w && b.x < a.x + a.w &&
         a.y < b.y + b.h && b.y < a.y + a.h;
}

function tryMove(block, dx, dy) {
  const next = { ...block, x: block.x + dx, y: block.y + dy };
  const inside = next.x >= 0 && next.y >= 0 &&
                 next.x + next.w <= COLS && next.y + next.h <= ROWS;
  if (!inside) {
    const side = dx > 0 ? "right" : dx < 0 ? "left" : dy > 0 ? "bottom" : "top";
    const vertical = side === "left" || side === "right";
    const start = vertical ? block.y : block.x;
    const end = start + (vertical ? block.h : block.w) - 1;
    const door = doors.find(d => d.side === side && d.color === block.color &&
                                 d.from <= start && d.to >= end);
    if (door) {
      blocks.splice(blocks.indexOf(block), 1);
      selected = null;
      moves++;
    }
    return;
  }
  if (blocks.some(o => o !== block && overlaps(next, o))) return;
  block.x = next.x;
  block.y = next.y;
  moves++;
}

function draw() {
  ctx.fillStyle = "#14161f";
  ctx.fillRect(0, 0, canvas.width, canvas.height);
  ctx.strokeStyle = "#2a2e3d";
  for (let i = 0; i <= COLS; i++) {
    ctx.beginPath();
    ctx.moveTo(PAD + i * CELL, PAD);
    ctx.lineTo(PAD + i * CELL, PAD + ROWS * CELL);
    ctx.moveTo(PAD, PAD + i * CELL);
    ctx.lineTo(PAD + COLS * CELL, PAD + i * CELL);
    ctx.stroke();
  }
  for (const d of doors) {
    ctx.fillStyle = d.color;
    const len = (d.to - d.from + 1) * CELL;
    if (d.side === "left")   ctx.fillRect(0, PAD + d.from * CELL, PAD, len);
    if (d.side === "right")  ctx.fillRect(PAD + COLS * CELL, PAD + d.from * CELL, PAD, len);
    if (d.side === "top")    ctx.fillRect(PAD + d.from * CELL, 0, len, PAD);
    if (d.side === "bottom") ctx.fillRect(PAD + d.from * CELL, PAD + ROWS * CELL, len, PAD);
  }
  for (const b of blocks) {
    ctx.fillStyle = b.color;
    ctx.fillRect(PAD + b.x * CELL + 4, PAD + b.y * CELL + 4, b.w * CELL - 8, b.h * CELL - 8);
    if (b === selected) {
      ctx.strokeStyle = "#ffffff";
      ctx.lineWidth = 3;
      ctx.strokeRect(PAD + b.x * CELL + 4, PAD + b.y * CELL + 4, b.w * CELL - 8, b.h * CELL - 8);
      ctx.lineWidth = 1;
    }
  }
  status.textContent = blocks.length ? "Moves: " + moves : "Cleared in " + moves + " moves!";
}

canvas.addEventListener("click", e => {
  const r = canvas.getBoundingClientRect();
  const cx = Math.floor((e.clientX - r.left - PAD) / CELL);
  const cy = Math.floor((e.clientY - r.top - PAD) / CELL);
  selected = blocks.find(b => cx >= b.x && cx < b.x + b.w &&
                              cy >= b.y && cy < b.y + b.h) || null;
  draw();
});

document.addEventListener("keydown", e => {
  if (!selected) return;
  const dir = { ArrowLeft: [-1, 0], ArrowRight: [1, 0],
                ArrowUp: [0, -1], ArrowDown: [0, 1] }[e.key];
  if (!dir) return;
  e.preventDefault();
  tryMove(selected, dir[0], dir[1]);
  draw();
});

draw();
</script>

Save it as an HTML file, open it in a browser, and play: move yellow left twice and out, blue up and out, red right until it exits, then green down. That is a working block jam game in about 100 lines.

Where to take it next

  • Slide-until-blocked movement. Call tryMove in a loop until the position stops changing. Most commercial versions feel like this.
  • Drag input. Track pointer down and up, take the dominant axis of the drag, and move that way.
  • Odd shapes. Swap the rectangle for a list of cell offsets so you can build L-shapes and T-shapes. The overlap check becomes a cell-by-cell set comparison.
  • Undo. Push a copy of the block array onto a stack before each move.
  • Juice. Tween positions instead of snapping, and add a pop and a sound when a block exits.

If you want to go further into rendering loops and input handling, our guide to building an HTML5 canvas game engine picks up exactly where this prototype stops.

JavaScript code on the left and the running block jam prototype on a browser canvas on the right
The prototype from this article: rectangles on a grid, a collision check and a door rule.

Building a block jam game with WizardGenie

Hand-coding is great for learning, but if your goal is a polished puzzle with menus, levels and effects, writing every line yourself is slow. This is where WizardGenie, the AI game engine inside Sorceress, fits. You describe the game you want, and WizardGenie writes the code, runs it and iterates on it with you. A game engine normally hands you building blocks to assemble; here the assembling happens through conversation, which is the workflow often called vibe coding.

WizardGenie runs on the web with nothing to install, and as a Windows desktop app with an auto-updater that gives native file access and longer agent sessions. It works with the leading AI coding models, and you can switch models with your own API key.

A prompt that works

The quality of the result tracks the precision of your rules. Vague prompts like “make a color block puzzle” leave the AI to guess. Spell the mechanics out:

Build a block jam puzzle on a 6x6 grid. Blocks are rectangles of 1x1 to 1x3 cells in red, blue, yellow and green. The player drags a block and it slides in that direction until it hits another block or a wall. Colored doors sit on the board edges and have a width in cells. A block exits only through a door of its color that is at least as wide as the block’s side facing it. Clear all blocks to win. Show a move counter, an undo button and a restart button. Include five levels that get harder, and make sure each one is solvable.

Then iterate in small steps: “add an exit animation and a pop sound,” “add a level with a fixed wall in the center,” “add a 15-move limit to level 4.” Small, testable requests keep the code understandable and make bugs easy to spot.

Adding art and sound

Colored rectangles are fine for testing, but a finished block jam game wants glossy blocks, a board texture and satisfying audio. AI Image Gen puts every top image model in one panel, so you can generate block skins, a board background and a title screen. Sound Studio covers AI music, sound effects and text-to-speech, plus a built-in audio editor for trimming, which is what you need for a soft slide sound, an exit chime and a calm loop for the menu. If you want a tiled board or background, Tileset Forge turns AI art into game-ready tilesets. The full lineup lives in the Sorceress tools guide.

When the game plays well, export the build and host it wherever you like.

Designing block jam levels and the mistakes to avoid

Code gets you a toy. Levels make it a game. A good block jam level has one clear “aha” moment, and the difficulty curve introduces one new idea at a time. Our level design guide for beginners covers the general principles; here is what matters for this genre specifically.

Two ways to guarantee a solvable level

  • Write a solver. Represent the board state as a string of block positions, then run breadth-first search over every legal move. If the search empties the board, the level works, and the path length tells you the minimum moves, which is a decent first estimate of difficulty and the right value for a move limit plus a small buffer.
  • Design in reverse. Start from an empty board. Place the last block to leave first, then place each earlier block so it traps the ones already placed. The order you placed them in, reversed, is a valid solution by construction.

Common mistakes

  1. Unsolvable levels. The worst bug a puzzle can ship. Always verify with a solver or reverse design, especially if an AI generated the layout.
  2. Difficulty from clutter, not ideas. More blocks is not harder, just busier. A tight 5x5 with one clever dependency beats a crowded 8x8.
  3. Introducing two mechanics at once. Show narrow doors in one level and axis-locked blocks in another before combining them.
  4. Ambiguous colors. Red and orange, or blue and purple, blur on small screens and for color-blind players. Add a symbol or pattern to each color.
  5. Bad touch targets. A one-cell block on a phone needs to be big enough to grab. Test at real screen sizes.
  6. No undo. Without it, one misdrag forces a restart and players quit.
  7. Move limits that are too tight early. Let players learn freely first; add limits once they understand the rules.

A practical target for a first release is a handful of tutorial levels, then a set of puzzles that each add one twist. If you are new to finishing projects, our walkthrough on how to make a video game from scratch covers scoping, which matters more than any single mechanic.

The full pipeline at a glance

Here is the whole path from “I like this puzzle” to “I made one,” in order:

  1. Learn the rules by playing. Grid, solid blocks, color-matched doors with widths, clear the board to win.
  2. Prototype the logic. Rectangles, an overlap check and a door rule, as in the code above.
  3. Scale up with WizardGenie. Describe the exact rules, then add levels, undo, animation and menus in small requests.
  4. Dress it. Block skins and backgrounds from AI Image Gen, slide and exit sounds plus music from Sound Studio.
  5. Design and verify levels. One idea per level, a solver or reverse design to prove each is solvable.
  6. Test on real screens, fix touch targets and color clarity, then export and host the build.

A block jam game looks simple because it is simple at its core, and that is exactly why it is such a good project. The rules fit on a sticky note, the art can start as flat colors, and every improvement you make is visible the moment you play. Start with the 100-line prototype, then let WizardGenie handle the parts that would otherwise eat your weekend.

Frequently Asked Questions

What is the goal of a block jam game?

The goal is to empty the board. Each colored block has to leave through an exit, often drawn as a door on the edge of the grid, that matches its color. Blocks cannot pass through each other, so you have to move them in the right order. Many versions add a move limit or a timer, which turns a simple clearing task into a planning puzzle.

Is a block jam game free to play?

Most versions are free to start, either in a browser or as a mobile download, and are usually supported by ads or optional purchases such as hints, extra moves or ad removal. Check the store listing before installing so you know what the version you pick asks you to pay for. You can also build your own small version in a browser with plain JavaScript at no cost.

How do you beat hard block jam levels?

Work backward from the exits. Find which block can leave first, then ask what is in its way, and clear that obstacle. Move long blocks early, since they cut the board into separate lanes. Avoid parking blocks in corridors or in front of doors. If a level has a move limit, count your planned moves before you touch anything, because one wasted shuffle can make the level unwinnable.

Can I make my own block jam game without coding?

Yes. An AI game engine such as WizardGenie lets you describe the game in plain English, then it writes, runs and iterates on the code for you. You still decide the rules: grid size, how blocks move, how doors work and what counts as a win. Clear rules in your prompt produce a working prototype faster than a vague request like “make a color puzzle.”

How do you make sure a block jam level is solvable?

The most reliable method is to write a small solver that tries every legal move with breadth-first search and reports the shortest solution. If it finds none, the level is broken. A second method is reverse design: start from an empty board and place blocks one by one so each new block traps the previous ones, which guarantees a solution exists by construction.

Sources

  1. Jam (disambiguation) — Wikipedia
  2. Game engine — Wikipedia
  3. Vibe coding — Wikipedia
  4. Indie game — Wikipedia
Written by Arron R.·2,961 words·12 min read

Related posts