Play n Tools

Free tools & games for everyone

Free · No sign-up · No accounts

Districting lab

See how district lines change election results: draw equal districts on a grid town of two fictional parties, compare seats, wasted votes and compactness.

Draw districts: pick a district number, then tap squares to put them in it. Purple voters are round, Orange voters square.

How to use it

  1. Make a town: its size, the share of voters for the fictional Purple party (the rest vote Orange), and how much like-minded voters live together.
  2. Draw districts by hand, or press a button: plain stripes, a map drawn to help one party, or a map that aims for seats in proportion to votes with compact districts.
  3. Every district must hold the same number of voters and be in one piece. The tables show each district’s winner, the seats, the efficiency gap and compactness.

Keyboard

TabMove between the district buttons and the squares
Enter or SpacePick a district, or paint the focused square

Tips

  • The two classic tricks are “packing” (squeezing one side’s voters into a few districts they win by a lot) and “cracking” (spreading them thinly so they lose everywhere else). Watch the wasted votes when you try them.
  • With 40 % of the votes, Purple can end up with anything from no seats to half of them in many towns, just from where the lines go.
  • The efficiency gap counts wasted votes: all votes for a loser, and a winner’s votes beyond what it needed. A large gap means one side’s votes were wasted much more.
  • Compact districts do not guarantee proportional results: where voters live matters too. Try a strongly clustered town.

About this tool

Drawing electoral districts so that they favour one side is often called gerrymandering, after an 1812 Massachusetts district said to look like a salamander. This lab uses a made-up town and two made-up parties to show the arithmetic; it says nothing about any real party or place. Researchers and courts have proposed many measures, each with known limits; the efficiency gap and Polsby-Popper compactness shown here are two of the best known.

The map maker starts from stripes and keeps trading two voters on the edges of two touching districts (so sizes stay equal), keeping only maps where every district stays in one piece. It accepts changes that bring it closer to the chosen goal, and early on also some that do not (simulated annealing), so it does not get stuck.

The tests recount every district, seat, wasted vote and compactness value in Python, and check that every map the maker draws has equal, connected districts.

See you tomorrow!

A fresh daily puzzle every morning, and new tools added every month.

Browse every product