← Technology, Science & Infrastructure ▣ Distilled locally

Artificial intelligence for the Z80

By Anne Barela
November 18, 2026  ·  Adafruit ↗

Artificial intelligence for the Z80

A new book on dfsantos.com teaches artificial intelligence by building it in BASIC on 8-bit hardware: a ZX Spectrum, a Spectrum Next or an emulator. The programs are short enough to read, change and run, and the point is to watch what happens when parameters change.

The early chapters time Bubble sort, Shell sort and Quicksort to show why a faster clock can’t make up for a slow algorithm. From there it covers an expert system that diagnoses tape-loading problems, an ELIZA-style chatbot built from patterns and substitutions, and a tic-tac-toe player using Minimax with alpha-beta pruning.

The second half moves from rules to data. Linear regression is fitted to real Mauna Loa CO₂ measurements with least squares, plotted on the Spectrum screen. k-NN and Naive Bayes classify role-playing characters, and k-means finds groups in a cloud of points without labels. A perceptron learns to tell horizontal lines from vertical ones, then hidden layers, the sigmoid function and backpropagation handle digit recognition on a 6 × 6 grid.

The last chapter is Conway’s Game of Life on a toroidal 20 × 20 board, with two arrays keeping the current generation separate from the next.

See more at dfsantos.com and content on GitHub.

Originally published by Adafruit ↗ · rebuilt here from its own full-text RSS feed · all rights remain with the publisher, please read and support them there.