by mbostock · 11y ago · 0 comments
The most enjoyable part of this project for me was implementing the NFL’s incredibly elaborate tie-breaking procedures in code: taking a plain English description of the rules (that requires some interpretation) and porting it to JavaScript.
http://www.nfl.com/standings/tiebreakingprocedures
We should be open-sourcing the simulator implementation (the model, but not the UI) soon so you can see how it works.
There was also a fun moment when I realized I could make the simulator 10x faster by computing only the seed of the selected team, rather than the full order of teams in the playoffs. This avoided a lot unnecessary sorting and tie-breaking!
The development process was incremental: first create a simple representation of the league (conferences, divisions, teams) and schedule (games, outcomes), then implement the necessary metrics (win percentage, strength-of-victory, etc.) and filters (e.g., head-to-head, common games), then finally the tie-breaking algorithm itself.
The incremental approach let me test the parts independently and reduce the amount of hair-pulling debugging unlikely scenarios. Though, there was still plenty of that… Fortunately the NFL has an official playoff computer I could use to test my implementation (for a single, complete scenario).
Why not the UI?