Classroom Seating Chart Generator

This page opens with the rules panel already out and a demo class loaded, so you can watch the generator work before you paste your own roster. Four rules are hard constraints; the tag alternation is a preference the solver follows when it has room.

Rules panel openSeeded and repeatableConflicts named, never hidden

The seating chart

One student per line. Add , A or , B for the tag; names stay in this browser.

24 students

Two-by-two tables with a walkway between every table.

24 students in 32 seats · 8 groups · seed 4242

What this layout gives you
MeasureValueHow it is counted
Seats32one per student, generated seat by seat
Tables88 × 4 = 32 seats
Groups8rotation units; the largest seats 4
Front-row seats8row 1 — the row nearest the board
Walkways4full-length empty columns or rows inside the seat block
Floor used27.5 × 14 ft11 columns × 5 rows at 2.5 ft × 2.8 ft
Rules: keep apart, sit together, front row, pins

Pinned seats: 0. Turn on lock mode below the chart, then tap a seat to pin the student in it.

The numbers, from this layout

Rule audit for this page’s roster and layout
CheckValueHow it is read
Students on the roster24typed, one per line
Seats in this layout32groups of four
Students seated24every rule kept
Keep-apart pairs3checked against the finished chart
Sit-together pairs2checked against the finished chart
Front-row pins2checked against the finished chart
Pinned seats0none written
Diagonal seats countnowhether a diagonal neighbour breaks keep-apart
Alternation tagonsoft preference, never overrides a rule
Seed4242same seed, same chart

What "keep apart" actually means here

Keep apart is the rule that makes a seating generator useful and the one most chart makers leave out. In this solver it forbids three things: sharing a table, pair desk or bench; sitting in a seat that touches the other student left, right, in front or behind; and, when the diagonals switch is on, sitting diagonally in front or behind. Seats on opposite sides of a walkway are two grid cells apart, so they are allowed — which is usually what a teacher means by "keep them apart but not in exile".

The rule is written once, in the engine, and the tests check it against real seat cells for every layout. That matters because "not next to each other" is easy to state and easy to get wrong: in a two-by-two table every seat is diagonal to one other seat, so a generator that only checks left and right will happily put a keep-apart pair across a table corner and call it done.

How the four hard rules are enforced

The engine groups students who must sit together into a single unit, orders units by how constrained they are — pinned seats first, then the largest together-group, then the units named in the most rules — and tries legal placements in cost order. A placement is rejected the moment it breaks a hard rule against anyone already seated, so the search cannot drift into an illegal chart and then report success.

The search has a fixed budget counted in placements, not seconds, so the same input always takes the same path. If the budget runs out the solver falls back to the placement that breaks the fewest rules, draws that chart, and lists every rule it could not keep. You get a decision to make, not a spinner.

The seed is part of the answer

Every chart carries a seed and the seed is in the address bar, so a chart is reproducible: same roster, same layout, same rules, same seed, same seats. That is what lets you print a chart in September, open the link in January, and get the same room. Press the dice for a new seed when you want a different arrangement; the button changes one number and nothing else.

The alternation tag is the soft rule. Mark students A and B and the solver prefers not to seat two A students side by side, and prefers a balanced mix at each table. It never breaks a hard rule to satisfy the tag, and it never refuses to seat a class because the tags cannot be perfectly alternated.

Reading the facts table under the chart

The table is generated from the same seat cells the chart is drawn from, so it is a report rather than a claim: seats, tables or desks, groups, front-row seats, walkways and the floor the layout uses in feet. Change the table count and every number in the table changes because the cells changed.

If a number looks wrong, it is checkable by hand. Eight tables of four is thirty-two seats; the front row of that layout is two tables wide, so eight seats; the walkways are the empty columns and rows between the table blocks. The unit tests assert the same counts for several room sizes so a future edit to the generator cannot quietly change what the page promises.

Questions this page gets asked

Can I keep two students apart across the whole room?

The rule is about proximity, not distance: keep apart forbids the same table and touching seats, including diagonals if you switch them on. If you need two students in different halves of the room, pin one of them to a seat in the half you want and add the keep-apart rule; the pin removes the ambiguity and the solver works around it.

Why does the generator sometimes refuse to place a class?

Because the rules contradict the furniture. Three keep-apart pairs that all have to be in the only two free tables cannot be satisfied, and no amount of shuffling will change that. The page says which pairs conflict and how many seats are left, so the fix is visible: add a table, drop a rule, or turn off diagonals.

Does the tag alternation guarantee a boy-girl pattern?

No, and it should not claim to. The tag is whatever you type — A and B, or two reading groups, or two languages. The solver prefers to alternate the tag along a row and to balance the tags at each table, but a hard rule always wins, and a class with seventeen A students and three B students cannot alternate.

What is the demo class on this page?

Twenty-four invented names with A/B tags, three keep-apart pairs, two sit-together pairs and two front-row pins. It exists so the rules panel has something real to act on before you paste a roster. Replace it with your own class and the demo is gone.

Every number on this page is computed from the seat grid in your browser: seats, tables, groups, front-row seats, walkways and the floor a layout uses. The grid is a model of a clear rectangular room at 2.5 ft per seat column and 2.8 ft per row, not a survey — check doors, fixed furniture and your own fire code before you move anything.