Companion film
A chart worth sharing
Change one allocation input, refine the reactive Visuals chart, and export deterministic SVG and PNG output.
49 secGrid 0.63.2
Open film page →Canonical Grid model
Auditable party-list seat allocation with pure quotient construction and native allocation.
What this model gives you
20 min to study · Source reviewed 2026-08-26
Continue with guided practiceExpected checkpoint
With the shipped politics module and the authored vote vector [100000, 60000, 20000] allocating six seats. There is no cutoff tie; the current verification contract certifies compilation, while the cookbook independently documents the seat result.
shared/politics.gs inlines the quotient and effective-number functions at compile time. The model still owns its votes, seat count, quotient table, and published audit trail.
A4 crosses three parties with divisors one through six. LARGE selects the sixth-highest quotient, and BYROW counts each party’s entries at or above that cutoff.
APPORTION receives only the votes, seat count, and named method. H9 checks conservation, while the side-by-side summary makes disagreement between H6 and H8 visible during review.
This fixture has no cutoff tie. For tied quotients, input order is the public deterministic tie-break, so preserve and document party ordering in any adapted model.
MODEL "D'Hondt Apportionment"
DESCRIPTION "Auditable party-list seat allocation with pure quotient construction and native allocation."
VERSION "1.0.0"
AUTHOR "Grid Team"
TAGS "canonical", "portable", "politics", "elections"
USE "shared/politics.gs" AS pol
# Party vote totals and a six-seat house. Input order is the public tie-break.
A1 = [100000, 60000, 20000]
A2 = 6
# Pure Grid quotient table: parties are rows, possible seats are columns.
A4 = [pol.dhondt_quotient(INDEX(A1, 1, party), divisor - 1) FOR party IN 1..3, divisor IN 1..6]
H4 = LARGE(A4, A2)
H6 = BYROW(A4, row => SUM(MAP(row, quotient => quotient >= H4 THEN 1 ELSE 0)))
# Native audited kernel. This result must match H6 for this no-cutoff-tie case.
H8 = APPORTION(A1, A2, "d'hondt")
H9 = SUM(H8) = A2
H10 = pol.effective_number(MAP(A1, votes => votes / SUM(A1)))
A12 = `pure={H6} native={H8} seats_conserved={H9} effective_parties={H10}`
END MODEL