Code Katas
Focused, repeatable coding exercises designed to build fluency in simulation-backed probability reasoning. Complete each kata multiple times until the setup feels automatic.
Kata 1: Birthday Collision Simulator
Time limit: 20 minutes
Goal: Estimate the probability of at least one repeated birthday in a room of size n
Setup: Write a function that simulates k rooms and compares the empirical estimate with the theoretical complement calculation
Repeat until: You can explain why the simulation and the complement formula should agree approximately.
Kata 2: Bayes Update Engine
Time limit: 15 minutes
Goal: Implement a helper that computes posterior probability from prior, sensitivity, and false-positive rate
Setup: Feed it several low-base-rate scenarios and print prior, evidence rate, and posterior clearly
Repeat until: You can describe every term in the update without mixing up direction.
Kata 3: Expectation by Indicators
Time limit: 20 minutes
Goal: Simulate and estimate the expected number of fixed points in random permutations
Setup: Count fixed points directly, then explain the indicator-variable solution on paper
Repeat until: You can connect the code result to the linearity argument.
Kata 4: LLN and CLT Sampler
Time limit: 25 minutes
Goal: Generate repeated sample means from a non-Normal distribution and observe stabilization plus approximate Normality of the sample mean
Setup: Use a skewed base distribution, vary sample size, and record mean/spread behavior
Repeat until: You can say what the LLN explains and what only the CLT explains.
Completion Standard
- Can implement each kata within the time limit
- Can explain the theory behind each simulation without rereading the concept page
- Can compare empirical output to theoretical expectations and describe the mismatch if one appears