Learning Computer Science Through Chess, Algorithms and Creative Experimentation

When people hear the term artificial intelligence these days, they often think of ChatGPT, image generators and other tools built around large language models (LLMs). But AI has been part of computer science for decades, long before chatbots became part of everyday life. There are many ways to build a system that can make decisions, solve problems or play a game. For Bush Chess, the approach was much more direct: we built a chess engine using algorithms, mathematical rules and a bit of experimentation.

We put Bush Chess together during a weekend session. There was no need to connect the game itself to a remote AI service, pay for an API or ask a language model to decide which move to make. The computer works with the rules of chess, examines possible moves and evaluates the likely consequences. It is a different kind of AI, and one that is particularly useful for people who want to understand how these systems work rather than simply use them.

The engine relies on an algorithm called Minimax, along with a technique known as alpha-beta pruning. The basic idea behind Minimax is straightforward: consider what happens if you make a move, then consider how your opponent might respond. Continue looking ahead, and choose the move that offers the best outcome against the opponent’s strongest response.

Of course, chess has an enormous number of possible moves and positions. Looking at every possibility would quickly overwhelm even a powerful computer. Alpha-beta pruning helps by cutting off lines of play that cannot improve the result. Instead of wasting time examining every branch of the decision tree, the engine can concentrate on the possibilities that matter most. This allows a relatively lightweight program to analyse many potential moves directly in a web browser.

The engine also needs a way to judge positions when it reaches the end of its search. It cannot calculate an entire game from every possible starting position, so it uses a heuristic evaluation function to estimate which side is better placed.

This is where some of the human decisions behind the program become visible. Each chess piece receives a numerical value. In our evaluation system, a pawn is worth 100 points, a knight or bishop about 300, a rook 500 and a queen 900. The engine also considers where pieces are positioned. A knight in the centre of the board, for example, generally has more opportunities than one tucked away in a corner. Pawns can receive additional value for advancing into useful positions, and other factors can influence the overall score.

These numbers are not universal truths about chess. They are practical rules of thumb that help the computer compare one position with another. Change the values or the way positions are scored, and the engine may start making different decisions. That makes the evaluation function an interesting part of the project to experiment with: you can change the rules that guide the computer’s choices and then see what happens on the board.

This is one reason we chose this approach for Bush Chess. The code gives us something concrete to work with and explore concepts. We can examine how a move is evaluated, adjust the search depth, change a piece’s value or investigate why the computer made a particular decision. We do not have to treat the system as a mysterious service running somewhere else.

That does not mean every decision is easy to explain just by looking at the final score. Search depth, move ordering, evaluation weights and other implementation details all affect the result. But the underlying process is accessible. We can follow the legal moves, inspect the positions being considered and identify the rules that influence the engine’s choices.

There is a useful contrast here with large language models. An LLM generates responses using patterns learned during training and a probabilistic process of selecting outputs. Its internal computations are not generally presented as a simple, step-by-step explanation that can be independently checked. Bush Chess works differently. Its move selection follows an explicit search procedure and a set of programmed evaluation rules. We can inspect those rules directly and test how changing them affects play.

Building the engine also gives us a practical way to introduce some important ideas in computer science. Increasing the search depth can improve the computer’s ability to anticipate trouble, but it also increases the amount of work required. A search that looks two plies ahead considers one move by each side; looking four plies ahead considers two moves by each side. The number of possible positions can grow rapidly as the search expands, which is why pruning and other optimisations matter.

There are smaller lessons, too. A computer can follow the legal moves of chess and still make strange decisions if its evaluation function is incomplete. It might repeatedly move pieces between the same squares or fail to recognise a position it has already encountered. Preventing this behaviour requires additional logic, such as repetition detection and appropriate handling of drawn positions. The machine does not automatically understand what makes a game enjoyable or when a decision is sensible. We have to account for those things in the program.

For us, Bush Chess is as much about making technology accessible as it is about playing chess. We built a working opponent in a short session, using familiar programming tools and established techniques. The result is something people can play with, but also something they can take apart, modify and learn from.

There is no need to dismiss newer forms of AI to appreciate what classical methods can do. Language models, neural networks and search algorithms solve different kinds of problems, and they can even be combined. The important point is that AI is not one technology, nor does every project need a large model or a remote service.

Sometimes a small program, a clear set of rules and a willingness to experiment are enough to build something interesting. Bush Chess gives us a chance to put that idea into practice, learn by changing things and have a bit of fun along the way.

The control tray lets players dial between human play, head-to-head local matches, and accelerated engine-versus-engine simulation. Watching algorithmic decision trees unfold at sub-second speeds turned out to be one of the prototype's most captivating features.
The control tray lets players dial between human play, head-to-head local matches, and accelerated engine-versus-engine simulation. Watching algorithmic decision trees unfold at sub-second speeds turned out to be one of the prototype’s most captivating features. Click the image to try it!