Rectangles (Simon Tatham's Puzzles)
Saved games stay in this browser only.
About the puzzle
Rectangles hands you a grid with numbers in some of its squares, and asks you to cut the whole grid into rectangles. Every rectangle must contain one of the numbers, and that number tells you how many squares the rectangle covers. A 6 can be a 1x6 strip or a 2x3 block; finding out which, and which way round, is the puzzle.
The idea comes from the Japanese puzzle publisher Nikoli, and the puzzle is also known as Shikaku. Simon Tatham's version generates a fresh grid of any size you like each time, and normally guarantees that it has one solution.
Rules
- Divide the grid into rectangles (squares count as rectangles too).
- Every rectangle contains exactly one numbered square.
- The area of each rectangle, in squares, equals its number.
Controls
| Input | Action |
|---|---|
| Left click on an edge | draw or erase that edge |
| Left-drag across squares | draw the outline of a whole rectangle (or a line), clearing edges inside it |
| Right-drag across squares | erase everything inside a rectangle, keeping its outline |
| Arrow keys | move the cursor |
| Enter, arrows, Enter | drag out a rectangle with the keyboard |
| Space, arrows, Space | erase the inside of a rectangle with the keyboard |
| Escape | cancel a keyboard drag |
| N / U / R | new game / undo / redo |
A rectangle of the right size with exactly one number gets shaded.
How to solve it
Start with the big numbers in tight spots. A large number near a wall or in a narrow gap between other numbers has few shapes that fit. List the possible rectangles (the factor pairs of the number) and test each one against the walls and the other numbers.
1s and primes. A 1 is a rectangle on its own, so wall it in straight away. A prime number such as 5 or 7 can only be a straight line, one square wide.
Who can reach this square? Look at an empty square and ask which numbers could possibly cover it. If only one number has a rectangle that fits there, that number owns the square, and that often settles its shape.
Rectangles cannot swallow two numbers. A shape that would contain a second number is out, and so is one that would leave a pocket of squares no number can reach.
Corners and edges. Squares in a corner of the grid have fewer possible owners than squares in the middle, so they are good places to look when you are stuck.
Sizes and difficulty
The Type menu has square grids from 7x7 to 19x19. Custom sets the width and height, an expansion factor that makes the grid out of fewer, larger rectangles (around 0.5 makes it harder), and whether the solution must be unique.
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 an edge or drag across squares to draw a rectangle; turn on the Mark button above the board to erase rectangles instead.
Credits and licence
Rectangles 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.