# The Pascal puzzles: the code

The Python behind the Pascal puzzles on slow-is-smooth.io. Standard library only. Run each script
from this folder, for example `python test_champagne.py`. `check_figures.py` also needs Node on the
PATH and a checkout of the site, because it reads the figures from `layouts/` and the cover from
`scripts/covers/`.

## Part 1: /blog/pascal-puzzles-the-champagne-tower/

- champagne.py: towers of any shape (the triangle, the square pyramid, glasses of any size),
  pouring a fixed amount, Pascal's flow through bottomless glasses, the formula that subtracts what
  the glasses above keep, bisection, and the exact fill events
- test_champagne.py: the checks and the report behind every number in the post
- check_figures.py: runs the figures' and the cover's shared JavaScript in Node and compares it with
  champagne.py's exact fractions
- check_post.py: runs the Python blocks of a published post in order and compares their output with
  the output the post shows: `python check_post.py ../../../content/blog/pascal-puzzles-the-champagne-tower.md`
