Compator

Series overview

Draughts AI Series: Follow-on Courses

Compator

Executive Summary

The purpose of this document is to set out a follow-on series to "Building an AI Draughts Game for the Web" that concentrates on artificial intelligence, and to support a decision on its structure and order. Course 1 taught one kind of AI, search. The four follow-on courses each teach a further kind: a language model that uses the game engine as a tool, machine learning through self-play and a small neural network, learning from the results of real players, and agents that combine a language model, tools and checks to carry out tasks of several steps. Course 1 is included alongside them for reference, as the foundation every follow-on course builds on. The scope is limited to the aim, modules, skills, server impact and main risk of each course. Detailed lessons, code and timings are out of scope until the structure is approved.

The outlines are based on the working Course 1 application, its UML design and the limitations already recorded in that course. Each course has been checked for whether it reuses the existing code, whether it needs more from the server, and whether its central technique is documented in a published source. Each course is named by the technique it teaches, so that every use of the word AI refers to something learners build and measure. Figures that have not yet been measured are marked as inferences. Sources are listed in the appendix.

Course Outlines

Course 1 is the foundation. Courses 2 to 5 build on it and keep all its tools. To stay readable, the outlines are split across two tables: Courses 1 to 3, then Courses 4 and 5.

Course 1: The Foundation Course 2: The AI Coach Course 3: The AI Learns
Kind of AI Search: minimax with alpha-beta pruning Language model with tool use Machine learning: self-play and a neural network
Aim Build and publish a mobile-friendly draughts web app with a computer opponent Answer players' questions with a language model that calls the minimax engine for every fact, and measure its accuracy Replace the hand-written scoring rule, first with learned numbers, then with a small neural network
Learners build The game for one or two players, three computer strengths and a daily scoreboard, live on Apache2 A coach panel that answers "why that move?" and "what if I move here?", and an accuracy report Self-play training scripts, Learned and Neural strength levels, and a comparison report
Modules

0-1. Before you start; the big picture

2-3. Setting up; the project layout

4-5. HTML; CSS and the mobile layout

6. The rules

7. The AI opponent

8. Bringing it together

9. The daily scoreboard (Flask)

10. Testing

11. Publishing on Apache2

12. Where next

1. What language models do well and badly

2. Running a model with Ollama

3. Turning the engine into tools

4. Tool calling: the model asks, the engine answers

5. A Flask route for the coach

6. Evaluation: how often the coach contradicts the engine

7. Deploying Ollama on the server

1. From rules of thumb to parameters

2. Self-play with Node.js

3. Hill climbing, as Samuel did in 1959

4. How many games prove an improvement

5. A maths primer for neural networks

6. Training a small network in Python

7. Running the network inside minimax in the browser

New skills HTML, CSS, JavaScript, Python and Flask, game-tree search, automatic tests, deploying to Apache2 Tool calling, grounding, prompt design, evaluation, timeouts Generating training data, training and testing, overfitting, statistics, deploying a model
Server needs An Ubuntu server with Apache2 and mod_wsgi. Tested on Ubuntu 24.04 More memory and processing than Course 1. To be measured on the course server before writing None for training, which runs on the learner's computer. The network runs in the browser
Main risk Beginners stall on set-up and deployment. Every step was run before writing, and troubleshooting tables are included Small local models may call tools unreliably. This is tested before writing, and Module 6 measures it The network may not beat the hand-written rule with a learner's computing time. The course measures and explains the result either way
Course 4: An Opponent That Adapts Course 5: Building an Agent Framework
Kind of AI Learning from real players' results Agents: a language model that plans its own steps with tools, with every answer checked
Aim Rate each player from real games and pick the AI strength that gives them an even game Build a small agent framework from scratch, use it for draughts and for a task unrelated to draughts, then compare it with an established library
Learners build Player ratings, ratings for each AI level and automatic choice of level The framework (tools, agent loop, checks, memory, teams, traces), three draughts agents that produce a tournament report a person approves, a helper that answers questions about any project's files, and a nightly unattended run
Modules

1. What the scoreboard data can and cannot show

2. Elo ratings explained

3. Rating the AI levels from real games

4. Matching players to a level

5. A/B testing a change

6. Handling data about people responsibly

0-1. Before you start; what makes an agent

2. Talking to any model

3. Tools from functions

4. The agent loop and its checks

5. The draughts tools

6. A team of agents

7. Beyond draughts

8. Evaluation and testing

9. The same ideas in a library

10. Running the team every night

11. Where next

New skills Working with real usage data, rating systems, experiments, data responsibility Agent design, tool limits, answer checks, human approval, teams of agents, tracing, evaluation over many runs, scheduled jobs
Server needs None beyond Course 1 Ollama, as in Course 2. A nightly tournament of 20 games took 52.7 seconds of engine time in the course workspace
Main risk Names are not unique and results can be faked, so ratings are indicative. The course teaches when the data can be trusted Small local models may not follow several steps reliably. Every agent was tested with a stand-in, and Module 8 measures the learner's own model before anyone relies on it

Optional add-on: Online Two-Player, with live play between devices and moves checked on the server. It is kept for learners who want the engineering side, but adds little AI.

Recommended order: Course 2, then 3, then 4, then 5. Course 2 is the most relevant to Compator's AI and cloud client work, and Course 3 is the most demanding for beginners. Course 5 comes last because it reuses code from Courses 2, 3 and 4.

Next step: approve this structure. Two checks will then be run on the course server before any lessons are written: whether a small local model calls tools reliably enough to teach, with its memory use and response time, and which browser library should run the neural network.

Glossary of Terms

Term Meaning
A/B test Comparing two versions of something by giving each to a different group and measuring which does better
Agent A language model given a goal, tools and a loop, which decides which tools to call, in what order, until the goal is met
Alpha-beta pruning A shortcut for minimax that skips moves which cannot change the final choice
Apache2 Free, open-source web server software, used to publish the game
Elo rating A number that rises or falls after each game according to how surprising the result was, so that ratings predict who is likely to win
Evaluation (of an AI) Measuring how often an AI system gives correct answers, using a fixed set of test cases with known answers
Evaluation function The rule of thumb the game AI uses to score a position. Course 3 learns it instead of writing it by hand
Flask A small Python toolkit for writing web applications, used for the scoreboard
Grounding Giving a language model verified facts to work from, so that it describes those facts rather than inventing its own
Hill climbing A simple way to improve something: make a small change, test it, and keep it only if it does better
Language model Software trained on large amounts of text to predict and generate text
Machine learning Software that improves its own behaviour from data or experience instead of following only hand-written rules
Minimax The search method used by the Course 1 opponent to choose the move with the best guaranteed result
Neural network A model made of many simple connected calculations whose strengths are adjusted during training
Ollama Open-source software for downloading and running language models on your own computer or server
Open-weight model A language model whose trained parameters can be downloaded and run locally, under the terms of its own licence
Overfitting When a learned result works well on its training data but no better, or worse, in real use
Parameter A number inside a program or model that can be adjusted, such as the value given to a king
Prompt The text and data sent to a language model to ask it for an answer
Self-play A program playing games against a copy of itself to produce results it can learn from
Tool calling A language model asking the surrounding program to run a function, such as an engine search, and using the result in its answer
Training The process of adjusting a model's parameters using data until it performs a task well

Appendix: Sources

Topic Source
Course 1 Building an AI Draughts Game for the Web, OUTPUTS/Draughts AI Course/Course 1 - Building an AI Draughts Game/
Course 5 Course 5: Building an Agent Framework, OUTPUTS/Draughts AI Course/Course 5 - Building an Agent Framework/
Learning by self-play Samuel, A. L. (1959) "Some Studies in Machine Learning Using the Game of Checkers", IBM Journal of Research and Development, 3(3), pp. 210-229: https://people.csail.mit.edu/brooks/idocs/Samuel.pdf
Tool calling in Ollama Ollama documentation, Tool calling: https://docs.ollama.com/capabilities/tool-calling
Running Ollama on Linux Ollama documentation, Linux: https://cdn.jsdelivr.net/gh/ollama/ollama@0.9.0/docs/linux.md
Elo ratings Wikipedia, "Elo rating system": https://en.wikipedia.org/wiki/Elo_rating_system