00 · Origin
CS212: design the program, not just the answer.
I originally developed this solution for Udacity CS212, Design of Computer Programs, taught by Peter Norvig, and received full credit for the assignment. The exercise begins with the rules of a dartboard and 501 double-out, then moves into a deliberately simplified model of imperfect accuracy.
The interesting question is not simply which target carries the highest nominal score. It is which target produces the strongest expected result when a player's throws can miss both the intended ring and the intended numbered section.
01 · My solution
Use ordering to simplify checkout search, then model uncertainty explicitly.
For the checkout problem, my approach puts zero first in the ordered list of possible dart scores. That lets a single search naturally represent one-, two-, and three-dart solutions: iterate the first two darts, calculate what the third dart must score, and convert the resulting numeric values back into board targets.
Checkout search
Ordered candidate scores allow shorter solutions to emerge before longer ones without three separate search passes.
Miss model
Ring error and section error distribute an intended throw across plausible landing regions.
Expected value
Every landing region contributes its score multiplied by its probability, allowing targets to be compared directly.
02 · Interactive probability lab
Change the aim point. Change the accuracy. Watch the distribution move.
This browser model follows the same board assumptions used in the course exercise. Select a target and adjust the miss rate to see the possible outcomes, expected score, and the highest expected-value target at that accuracy.
Board probability map
The maize marker is the intended target. Green markers show the highest-probability landing regions; larger markers are more likely.
Outcome distribution
Each row shows a possible landing target, its probability, and the score attached to that result.
03 · Double-out checkout lab
Find a route and see how accuracy changes the chance of executing it cleanly.
The original assignment also required a shortest one-, two-, or three-dart checkout with the final dart in a double. Enter a total below to generate a route. The probability shown is the chance of hitting that planned route exactly at the selected miss rate; it is intentionally not an adaptive full-game strategy model.
Planned checkout
04 · Validation
Revisit the model with broader tests, not a different story.
When I revisited the project, I expanded the validation beyond the original examples. The modern test set checks broad checkout ranges, verifies that a checkout ends on a double, preserves explicit zero-score off-board outcomes, and checks that representative probability distributions retain their full probability mass.
- Historical behavior remains the baseline.The original course examples and expected-value cases remain part of the validation set.
- Boundary conditions are exercised explicitly.Impossible totals, legal double-outs, and off-board outcomes are checked rather than inferred.
- Probability mass matters.A distribution should account for every outcome, including a throw that misses the board.
- Interactive output is another validation surface.The browser makes assumptions and probability shifts visible instead of hiding them in console output.
05 · Compare approaches
Same problem, different choices about abstraction.
Norvig's reference implementation provides a useful comparison because the core checkout idea is strikingly similar while the probability code is decomposed more aggressively. The contrast is less about right versus wrong than about how two implementations organize the same model.
Implementation comparison
| Design question | My approach | Norvig reference |
|---|---|---|
| Shortest checkout | Zero-first ordered scores; calculate the third dart from the remaining total. | Same fundamental ordered-search strategy. |
| Target naming | Explicit procedural conversion from score to board target. | Compact generalized naming function. |
| Probability construction | Direct conditional implementation of target outcomes. | Separate ring and section distributions, then combine them. |
| Expected value | Explicit accumulation across possible outcomes. | Dedicated expected-value function used by a compact maximization step. |
| Validation | Course tests plus expanded modern regression coverage. | Broad reference test cases across checkout and probability behavior. |