Tents (Simon Tatham's Puzzles)

Saved games stay in this browser only.

About the puzzle

Tents is set on a campsite: a grid with trees scattered over it. Each tree gets one tent, pitched on a square right next to it, and the numbers along the edges say how many tents go in each row and each column. Campers like their privacy, so no two tents may touch, not even at a corner.

The puzzle turns up in many places online and in puzzle magazines, often as Tents and Trees; Simon Tatham writes that it reached him by e-mail and that he does not know who invented it.

Rules

  • There are exactly as many tents as trees.
  • Tents and trees can be paired off so that every tent is directly above, below, left or right of its own tree (a tent may also touch other trees).
  • No two tents are adjacent, horizontally, vertically or diagonally.
  • The number of tents in each row and column matches the clue for it.

Controls

Input Action
Left click on an empty square pitch a tent
Right click on an empty square colour it green: no tent here
Right-drag along a row or column colour every blank square on the way green
Click on a filled square clear it
Arrow keys move the cursor
Enter / Space tent / green on the square under the cursor (either clears a filled one)
Shift+arrow / Ctrl+arrow colour empty squares green while moving / also over tents
N / U / R new game / undo / redo

How to solve it

Clear the impossible squares. A square that does not touch any tree side on can never hold a tent; nor can any square in a row or column with a 0. Painting these green first shows how little room is really left.

Full rows and columns. When a row already has all its tents, the rest of it is green. When the number of free squares left equals the tents still needed, they all get tents, though remember the no-touching rule: in a run of free squares, tents can only go on every other one.

Lonely trees. A tree with only one free square beside it puts its tent there.

Around every tent, grass. The eight squares around a tent can never hold another tent. Each tent you place clears a little ring of green.

Count in strips. Two rows next to each other can never have tents directly above one another or diagonally adjacent, so a 2x2 block never holds more than one tent. Splitting a pair of rows into 2x2 blocks and comparing with their combined clues often tells you exactly which blocks hold a tent.

Pair tents with trees. Each tent belongs to one tree. If a tree's only remaining candidates are next to a tent that another tree needs, the pairing decides which.

Sizes and difficulty

The Type menu has 8x8, 10x10 and 15x15 grids at Easy and Tricky difficulty; neither needs guessing. Custom sets any width and height.

Playing here

Click Play to open the puzzle. The menu above the board has New game, Restart, Undo, Redo and Solve (which you can undo to keep going on your own), the Type menu with the sizes, and the Game menu, where you can type in a game ID or a random seed, download the current game as a file, load a saved file and change the preferences. Your game in progress is kept in this browser and comes back with its whole undo history the next time you open the page.

On a touch screen, tap a square to pitch a tent; turn on the Mark button above the board to colour squares green, dragging along a row to fill it.

Credits and licence

Tents is part of Simon Tatham's Portable Puzzle Collection, written by Simon Tatham with code contributed by several other authors, and distributed with its source code under the MIT licence. This page runs a WebAssembly build made by FredyGames from the author's official source snapshot, with no changes to the puzzle; the source and the build script are hosted with the game, and the licence text is linked from this page.