Skip to content
Game 8 16 Units

Minefield

A grid logic game in the style of Minesweeper, built with 2D arrays.

What You’ll Build

A Minesweeper-style logic game on an 8x8 grid. Mines are hidden beneath the cells. Reveal a cell to see how many mines surround it. Use that number to deduce where the mines are. Reveal every safe cell to win — step on a mine and the game is over.

Minefield gameplay — numbered grid with cursor

Why This Game?

In Treasure Hunt, the screen was the data. You read colours with ATTR to detect collisions. That works for simple games, but it limits what you can do. What if a cell needs to store a number and a colour and a hidden/revealed state? One ATTR byte can’t hold all of that.

Minefield separates data from display. The game world lives in arrays — m(8,8) for the mine grid and s(8,8) for each cell’s state. The screen is just a view of that data. This is how every serious game works: data first, display second.

What You’ll Learn

  • 2D arraysDIM m(8,8) creates a grid in memory
  • Random placement — filling a grid with mines at random positions
  • Neighbour counting — checking all 8 cells around a position
  • Boundary guards — handling edges without crashing
  • Parallel arrays — one for data, one for state
  • GO SUB architecture — subroutines for calculate, draw, and HUD
  • Cursor movement — navigating a grid with INKEY$
  • Reveal and flag — two different actions on the same cell
  • Win/lose conditions — counting remaining safe cells
  • Difficulty selection — variable mine counts
  • Visual design — colour-coded cells on a black background
  • Title screens — instructions and controls
  • End screens — game over and victory with scoring

Prerequisites

Complete Game 7: Treasure Hunt first. You’ll need game loops, INKEY$, GO SUB, and movement on a grid.

Time Investment

16 units at 45-75 minutes each. Roughly 12-20 hours total.

Unit Roadmap

16 of 16 units available