AI programming exercises

A series of online AI programming exercises. For use in any AI course.

Each step has: (a) a running online program to implement some AI concept, (b) a video introduction, (c) notes to explain the program, and: (d) exercises for students to do. Students can edit and run these programs in the browser, with no install.

These exercises are based on AI programs by Daniel Shiffman of The Coding Train and The Nature of Code. Ported with permission under MIT licence.

The exercises involve making modifications to a series of AI programs (called "Worlds" on Ancient Brain), including the following Worlds. Click images to run them.

Character recogn...
2047 runs ♦ 0 likes
By "Coding Train" p...  
Created: 5 Jul 2019
Modified: 17 Sep 2023
Neural network to do character recognition from image database and from handwriting in real-time.
GA (Finnegans Wake)
1117 runs ♦ 0 likes
By "Coding Train" p...  
Created: 2 May 2019
Modified: 17 Sep 2023
Genetic Algorithm to write the first line of Finnegans Wake.
Breadth-first se...
3388 runs ♦ 0 likes
By "Coding Train" p...  
Created: 30 Apr 2019
Modified: 17 Sep 2023
Breadth-first search with a Force-directed graph.
A star
4961 runs ♦ 2 likes
By "Coding Train" p...  
Created: 1 May 2019
Modified: 17 Sep 2023
"A Star" algorithm to find shortest path through maze.


Before you start: Do the Ancient Brain Tutorial


Contents

  1. Binary tree
  2. Breadth-first search
  3. Breadth-first search (graphical)
  4. A* search
  5. Genetic Algorithm
  6. Genetic Algorithm for TSP
  7. Perceptron
  8. Neural network for XOR
  9. Character recognition neural network


Bonus World: Chat GPT

The following World calls the OpenAI API to talk to GPT-3.5.
We do not have exercises for this World but you could think of some:


Chat with GPT model
962 runs ♦ 3 likes
By Starter user  
Created: 18 Sep 2023
Modified: 3 Oct 2023
JavaScript page to chat with a GPT model. Calls OpenAI API. User needs to enter API key.


Credits


Notes


Preview

As a preview, here is the video for the Genetic Algorithm exercise.

Notes on videos


AI exercises, not an AI course

This is not a full AI course. It does not introduce you to AI theory, which would be a huge undertaking. To learn AI theory, you need to do a course elsewhere.

Rather, this is a series of AI programming exercises that teachers and lecturers can use in AI courses, and that students can use to try out the AI theory they have learnt.


Get started:

Step 1 of 9