Introduction to Computer Science YMT113 · Fall 2026 Assoc. Prof. Ferhat Uçar
10 Python · AI · SQL Monday, November 23, 2026

Artificial Intelligence: How It Actually Works

From decision trees and minimax to machine learning, neural networks and large language models. What a transformer does with your prompt, why models hallucinate, and how to use AI well as a programmer.

CS50Week ai · Artificial Intelligence ReadCS50 AI lecture notes >_ Lab 8: Minimax and a Model

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

  1. Prompts: system prompt versus user prompt; what cs50.ai’s duck is instructed to do and not do.
  2. 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.
  3. Machine learning: learning a function from labeled examples; reinforcement learning, explore versus exploit, the Nim demo.
  4. Neural networks: neurons as weighted sums, activation, layers, training as adjusting weights to reduce error; deep learning.
  5. Large language models: tokens, embeddings, attention, next-token prediction, temperature, context windows, hallucination.
  6. 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

Tags:artificial intelligenceminimaxdecision treemachine learningreinforcement learningneural networklarge language modeltransformerprompt engineeringhallucination