Spectrum · BASIC · gateway
Sinclair BASIC
Learn programming from scratch by building games
CPU
Zilog Z80
RAM
48 KB
Language
Sinclair BASIC
Where you are
02 · Language primer and gateway route
Sinclair BASIC is the beginner route into real programs on a real machine.
This route turns the shared programming ideas into Spectrum code: printed text, colour, sound, input, arrays, DATA, state, and complete games that make the machine's limits visible.
- No prior programming experience is assumed.
- Foundations are optional if you want the ideas explained before the Spectrum syntax.
- The assembly route is independent, but BASIC gives you a strong feel for the screen, colour model, and constraints.
Games
Sixteen complete games teaching Sinclair BASIC from absolute zero — from a number-guessing game to a Sokoban-style push puzzle. The first eight teach the language; the next eight build turn-based games around arrays, data, and state.
01
PrimerBefore the games: learn to write, run, edit and debug Sinclair BASIC for real — and meet the screen, colour, sound and motion games are made of.
1 games02
First ProgramsLearn the language by building eight small games. Each adds one dimension — colour, sound, screen control, strings, data — until your programs look like real Spectrum software.
8 games1

Story Builder
Your first program — ask questions, build a story
PRINTCLSINPUTString variables
2

Lucky Number
Guess the number — the screen responds with colour and sound
ABS / distanceColour feedback (BORDER)Directional sound (BEEP)An offered start (PAUSE)A rating from a guess count
3

Oracle Stone
Ask a question — the Oracle pretends to think
Selection (chained IF/THEN on RND)Suspense (PAUSE / BEEP)Colour as a voice (INK)GO SUB subroutinesBlock graphics (CHR$ 143)
4

Reflex
Wait for the flash — press any key — see your time
INKEY$PLOT / DRAWLoop-counter timing
5

Dice Roller
Roll dice and watch patterns emerge from randomness
Accumulation (tally counters)A live dashboard (PRINT AT in place)Player input sets the run (INPUT)Data visualisation (CHR$ 143 bar charts)
6

Bright Spark
Watch the panels flash, repeat the sequence
Strings as growing sequencesSTR$ / VAL / LEN / indexingThe flash (BRIGHT + BEEP)The game loop (show, repeat, check, grow)
7

Hi-Lo
Higher or lower — protect your streak
AND + the ok-flag verdictLoop-until-condition (the streak)User-defined graphics (the cards)Best-score tracking
8

Touchdown
Land the spacecraft — gravity pulls, fuel burns
The continuous (real-time) game loopGravity / thrust physicsSprite animation (erase-and-redraw)Ambient feedback (BORDER / BEEP)
03
Patterns of StateTurn-based games built on structured data — arrays as boards and maps, DATA-driven levels, hidden state, and your first AI opponents. From word-guessing to a push puzzle.
8 games9

Cipher
Guess the word one letter at a time
Slice-assignment into a stringDATA as a content list (RESTORE + counted READ)A tried-set (string membership)Data-driven design
10

Quiz Master
Four rounds, climbing score, ratings to chase
DIM arrays (indexed storage)An answer-key arrayRESTORE to a line (DATA sections)A per-category score array
11

Locksmith
Crack the code — logic and deduction
Parsing input into an arrayComparing two arrays (bulls)The digit-counting cow algorithmA history log for deduction
12

Sonar
Hunt by coordinates on a hidden grid
Two-dimensional arrays (DIM g(8,8))Probing by coordinateManhattan distance with ABSColour-coded clues
13

Three in a Row
The computer plays against you
Win detection from a DATA line tableReusable GO SUB board checksGame AI as a priority of rules (win, block, strategy)Why sound play forces a draw
14

The Caverns
Fear of the unseen — atmosphere through hidden information
A graph in parallel arrays (DATA-loaded)Navigation by following linksHidden state sensed by adjacencyA moving hazard and indirect clues
15

Yearfall
Choices land later — resource management
Persistent multi-variable stateAllocation under constraintsA random harvest you cannot controlDelayed, compounding consequences
16

Crates
Push crates to targets — the mechanic is the game
A 2D array as the writable worldDATA-string level layoutsReal-time movement with INKEY$A push built from a two-cell lookahead
