Spontaneous Swift Sudoku Solving
summary
Live-codes a working Sudoku solver in Swift that first applies constraint propagation (fill cells with a single candidate) and then a recursive backtracking brute force that picks the unsettled cell with the fewest candidates to prune the search tree. Uses Swift’s Sequence/Collection protocols for indexing and filtering, models failures with Swift error handling (a consistency error to reject branches), and relies on deep copy via structs to mutate trial boards. Optimization yields roughly a 3–4× speedup and produces solved boards within seconds.
AI-written summary · about
chapters (10)
- 0:00Start
- 8:18Sanity Check
- 11:04Naked Twin Strategies
- 12:37The Naive Solver
- 12:50Strategy
- 16:08Consistency Error
- 16:43Recursion
- 18:00Optimization
- 21:12Swift Features
- 21:49Swift's Sequencing Collection System








