Before class · do this at home
Watch, read, then come
CS50x 2026 · Week ai: Artificial Intelligence by David J. Malan. Watch the lecture on YouTube (you are also enrolled on edX), read the notes, skim the slides. Our lecture builds on it instead of repeating it.
- Watch the lecture. Then ask an AI assistant (ChatGPT, Claude, Gemini or cs50.ai) to explain minimax to you, and note one thing it got wrong or vague.
- Bring a question you would like an LLM to answer about your project; we will test it in the lab.
Learning objectives
By the end of this week you can:
- 1 Explain decision trees and the minimax algorithm, and play out tic-tac-toe with it.
- 2 Describe machine learning as learning a function from examples, and reinforcement learning as learning from reward.
- 3 Explain what a neural network is (weighted sums and nonlinearities) and what training does.
- 4 Describe what a large language model predicts, what a transformer's attention does, and why hallucinations happen.
- 5 Write system and user prompts that get reliably better results, and evaluate an answer critically.
- 6 Call an LLM from a Python program through an API.
★ the wow moment
A language model has never seen a word. It sees numbers, and it predicts the next number.
Your prompt is cut into tokens, each token becomes a list of a few thousand numbers, and the model computes which number is most likely next, over and over. There is no lookup, no database of facts, no understanding in the way you mean it. That is why it can write a beautiful essay and also invent a court case that never existed. Knowing this makes you the person in the room who uses AI well.
Topics
- Prompts: system prompt versus user prompt; what cs50.ai’s duck is instructed to do and not do.
- Decision trees and minimax: tic-tac-toe as a game tree, scores of −1/0/+1, why it is exhaustive for small games and why chess needs pruning and heuristics.
- Machine learning: learning a function from labeled examples; reinforcement learning, explore versus exploit, the Nim demo.
- Neural networks: neurons as weighted sums, activation, layers, training as adjusting weights to reduce error; deep learning.
- Large language models: tokens, embeddings, attention, next-token prediction, temperature, context windows, hallucination.
- Using AI as a programmer: what to ask, what to verify, how to keep your own understanding, and course policy.
Full notes are published before the lecture. The lab, Lab 8: Minimax and a Model, implements minimax for tic-tac-toe in Python and calls an LLM API with a system prompt you design.
In industry
-
Every developer now works with an AI
GitHub reports most new code on the platform is written with Copilot assistance. The skill is not typing less; it is specifying clearly, reading critically and testing everything.
-
Minimax runs the games you play
Chess engines, game AI and many planning systems are minimax with pruning and heuristics. Stockfish evaluates tens of millions of positions per second with exactly this idea.
-
Recommendation systems are machine learning
Netflix, Spotify, TikTok and your ad feed are functions learned from your clicks. Understanding the loop, data → model → prediction → more data, is understanding modern media.
-
Hallucination is a product risk
Air Canada was ordered to honor a refund policy its chatbot invented. Companies now hire engineers whose job is evaluation: measuring how often the model is wrong.
Lab 8: Minimax and a Model
Write an unbeatable tic-tac-toe player with minimax, then call a large language model from Python with a system prompt you design and evaluate its answers. Python · due Fri, Nov 27 · 23:59 · 10 points · opens in week 10 Open lab instructions →Go deeper
- CS50x 2026 · AI lecture notes
- But what is a neural network? (3Blue1Brown) · The best 19 minutes on the topic.
- Transformers, explained visually (3Blue1Brown)
- Claude API documentation · For the lab's API call.
Tags:artificial intelligenceminimaxdecision treemachine learningreinforcement learningneural networklarge language modeltransformerprompt engineeringhallucination