SGT‐RECT(6)

🌸 NAME 🌸

okay so bestie, welcome to sgt-rect — the Rectangles puzzle, living in section 6 of the manual (that's the Games section, iykyk) 💖


✨ SYNOPSIS ✨

sgt-rect [--generate n] [--print wxh [--with-solutions] [--scale n]
[--colour]] [game-parameters|game-ID|random-seed]

sgt-rect --version

🎀 DESCRIPTION 🎀

So picture this: you've got a grid of squares, and some (but not all) of those squares have numbers written in them. Your job — your whole entire mission — is to subdivide that grid into rectangles of various sizes, such that:

  • (a) every single rectangle contains exactly one numbered square, and
  • (b) the area of each rectangle is equal to the number written in its numbered square. 💅

Credit for this game goes to the Japanese puzzle magazine Nikoli (https://www.nikoli.co.jp/en/puzzles/shikaku/) — they're the moment, they're the blueprint. I've also seen a Palm implementation at Puzzle Palace (https://web.archive.org/web/20041024001459/http://www.puzzle.gr.jp/puzzle/sikaku/palm/index.html.en). Unlike Puzzle Palace's implementation, my version automatically generates random grids of any size you like. So the quality of puzzle design is therefore not quite as good as hand-crafted puzzles would be, but on the plus side you get an inexhaustible supply of puzzles tailored to your own specification. no cap. 🦋


🕹️ Rectangles controls 🕹️

This game is played with the mouse or the cursor keys. pick your fighter 🫶

  • Left-click any edge to toggle it on or off, or left-click and drag to draw an entire rectangle (or line) on the grid in one go — and yes, that removes any existing edges within that rectangle. slay.
  • Right-clicking and dragging will let you erase the contents of a rectangle without affecting its edges. sneaky but valid ✨
  • Alternatively, use the cursor keys to move the position indicator around the board. Pressing the return key then allows you to use the cursor keys to drag a rectangle out from that position, and pressing the return key again completes the rectangle. Using the space bar instead of the return key allows you to erase the contents of a rectangle without affecting its edges, as above. Pressing escape cancels a drag. main character energy fr fr 💜
  • When a rectangle of the correct size is completed, it will be shaded. the little dopamine hit. iconic.
  • (All the actions described below are also available.) 👑

🧚 Rectangles parameters 🧚

These parameters are available from the ‘Custom...’ option on the ‘Type’ menu. 🎀

  • Width, Height — Size of grid, in squares. that's it that's the grid 💖
  • Expansion factor — This is a mechanism for changing the type of grids generated by the program. Some people prefer a grid containing a few large rectangles to one containing many small ones. So you can ask Rectangles to essentially generate a smaller grid than the size you specified, and then to expand it by adding rows and columns.

The default expansion factor of zero means that Rectangles will simply generate a grid of the size you ask for, and do nothing further. If you set an expansion factor of (say) 0.5, it means that each dimension of the grid will be expanded to half again as big after generation. In other words, the initial grid will be 2/3 the size in each dimension, and will be expanded to its full size without adding any more rectangles.

Setting an expansion factor of around 0.5 tends to make the game more difficult, and also (in my experience) rewards a less deductive and more intuitive playing style. If you set it too high, though, the game simply cannot generate more than a few rectangles to cover the entire grid, and the game becomes trivial. 🙈

  • Ensure unique solution — Normally, Rectangles will make sure that the puzzles it presents have only one solution. Puzzles with ambiguous sections can be more difficult and more subtle, so if you like you can turn off this feature and risk having ambiguous puzzles. Also, finding all the possible solutions can be an additional challenge for an advanced player. Turning off this option can also speed up puzzle generation. ⭐

🌈 Common actions 🌈

These actions are all available from the ‘Game’ menu and via keyboard shortcuts, in addition to any game-specific actions. 🫶

(On Mac OS X, to conform with local user interface standards, these actions are situated on the ‘File’ and ‘Edit’ menus instead.) 🍓

  • New game (N, Ctrl+N) — Starts a new game, with a random initial state. fresh start bestie 💅
  • Restart game — Resets the current game to its initial state. (This can be undone.) so don't panic 💖
  • Load — Loads a saved game from a file on disk.
  • Save — Saves the current state of your game to a file on disk.

The Load and Save operations preserve your entire game history (so you can save, reload, and still Undo and Redo things you had done before saving). the way that it remembers everything… obsessed. 🧚

  • Print — Where supported (currently only on Windows), brings up a dialog allowing you to print an arbitrary number of puzzles randomly generated from the current parameters, optionally including the current puzzle. (Only for puzzles which make sense to print, of course – it's hard to think of a sensible printable representation of Fifteen!) 😭
  • Undo (U, Ctrl+Z, Ctrl+_, *) — Undoes a single move. (You can undo moves back to the start of the session.) yes you can go ALL the way back. no judgement. ✨
  • Redo (R, Ctrl+R, #) — Redoes a previously undone move.
  • Copy — Copies the current state of your game to the clipboard in text format, so that you can paste it into (say) an e-mail client or a web message board if you're discussing the game with someone else. (Not all games support this feature.) 🦋
  • Solve — Transforms the puzzle instantly into its solved state. For some games (Cube) this feature is not supported at all because it is of no particular use. For other games (such as Pattern), the solved state can be used to give you information, if you can't see how a solution can exist at all or you want to know where you made a mistake. For still other games (such as Sixteen), automatic solution tells you nothing about how to get to the solution, but it does provide a useful way to get there quickly so that you can experiment with set-piece moves and transformations.

Some games (such as Solo) are capable of solving a game ID you have typed in from elsewhere. Other games (such as Rectangles) cannot solve a game ID they didn't invent themself, but when they did invent the game ID they know what the solution is already. Still other games (Pattern) can solve some external game IDs, but only if they aren't too difficult. 💀

The ‘Solve’ command adds the solved state to the end of the undo chain for the puzzle. In other words, if you want to go back to solving it yourself after seeing the answer, you can just press Undo. peek responsibly bestie 👑

  • Quit (Q, Ctrl+Q) — Closes the application entirely. bye bestie 🥺
  • Preferences — Where supported, brings up a dialog allowing you to configure personal preferences about a particular game. Some of these preferences will be specific to a particular game; others will be common to all games.

One option common to all games allows you to turn off the one-key shortcuts like N for new game or Q for quit, so that there's less chance of hitting them by accident. You can still access the same shortcuts with the Ctrl key. ✨

🎀 Specifying games with the game ID 🎀

Okay bestie, listen, this is the part where you learn how to save a puzzle setup and then bring it back to life later — or hand it to a friend so they're playing the exact same game as you. Two ways to do it. Both slay. ✨

The ‘Specific’ and ‘Random Seed’ options from the ‘Game’ menu (or the ‘File’ menu, on Mac OS X) each show you a lil piece of text — a ‘game ID’ — and that text is literally enough to rebuild precisely the same game later. Iconic.

You can paste either one of those texts back into the program (via those same ‘Specific’ or ‘Random Seed’ menu options) whenever, and boom, same game. You can also feed either one in as a command line argument (on Windows or Unix) — more on that below. 💅

So what's the difference between the two forms? Okay so:

  • A descriptive game ID is a literal description of the starting state of the game.
  • A random seed is just arbitrary text that got fed as input into the random number generator that made the puzzle.

Which means:

  • Descriptive game IDs tend to be longer in a lot of puzzles (though some, like Cube (sgt-cube(6)), only need very short descriptions). So a random seed is often the quicker way to jot down the puzzle you're in the middle of, or to tell it to somebody else so they can play the same one as you.
  • Any text at all is a valid random seed. The automatically generated ones are fifteen-digit numbers, but honestly anything goes — type your full name, type a word you just made up, it'll still generate a valid puzzle. This is a whole way for two or more people to race to finish the same puzzle: you think of a random seed, everybody types it in at the same time, and nobody has an advantage from having seen the generated puzzle beforehand. Fair fight, periodt. 🔥
  • It's often possible to convert puzzles from other sources (like ‘nonograms’ or ‘sudoku’ from newspapers) into descriptive game IDs suitable for use with these programs. Big brain moment.
  • 🚨 Random seeds are not guaranteed to produce the same result if you use them with a different version of the puzzle program. Why? Because the generation algorithm might have been improved or modified in later versions of the code, so it'll produce a different result when given the same sequence of random numbers. Use a descriptive game ID if you aren't sure it'll be used on the same version of the program as yours.

(Use the ‘About’ menu option to find out the version number of the program. Programs with the same version number running on different platforms should still be random-seed compatible.)


Format vibes, since you gotta recognise these on sight:

  • A descriptive game ID starts with a piece of text encoding the parameters of the current game (grid size, that kind of thing), then a colon, and after the colon comes the description of the game's initial state.
  • A random seed starts with a similar string of parameters, but then it's got a hash sign followed by arbitrary data.

If you enter a descriptive game ID, the program cannot show you the random seed that generated it, because it wasn't generated from a random seed at all. If you enter a random seed, though, the program can show you the descriptive game ID derived from that random seed. Slay. 🦋

Heads up bestie: the game parameter strings are not always identical between the two forms. For some games there's parameter data attached to the random seed that doesn't show up in the descriptive game ID — because that extra parameter info only matters when generating puzzle grids, and it's irrelevant when playing them. So for example, the difficulty level in Solo (sgt-solo(6)) is not mentioned in the descriptive game ID. 🫶

And those extra parameters also don't stick if you type in a game ID. Picture this: you've got Solo set to ‘Advanced’ difficulty, and then a friend wants help with a ‘Trivial’ puzzle. Friend reads out a random seed specifying ‘Trivial’ difficulty, you type it in. The program generates you that exact same ‘Trivial’ grid your friend was struggling with — but once you've finished it, when you ask for a new game it'll automatically go back to the ‘Advanced’ difficulty it was previously set on. It remembers its roots. 💜

🌸 The ‘Type’ menu 🌸

The ‘Type’ menu, if present, may contain a list of preset game settings. Pick one and it starts a new random game with the parameters you specified. Easy.

The ‘Type’ menu may also contain a ‘Custom’ option which lets you fine-tune game parameters. What parameters are available depends on the game, and they're described in the following sections. 👑

✨ Specifying game parameters on the command line ✨

(This section does not apply to the Mac OS X version.)

The games in this collection deliberately do not ever save information on to the computer they run on: no high score tables, no saved preferences, nothing. (This is because I expect at least some people to play them at work, and those people will probably appreciate leaving as little evidence as possible! 😭)

But — if you do want one of these games to default to a particular set of parameters, you can specify them on the command line. Obsessed with a custom setup? Say less.

The easiest way to do this:

  1. Set up the parameters you want using the ‘Type’ menu (see above).
  2. Then select ‘Random Seed’ from the ‘Game’ or ‘File’ menu (see above).

The text in the ‘Game ID’ box will be composed of two parts, separated by a hash. The first of those parts represents the game parameters (the size of the playing area, for example, and anything else you set using the ‘Type’ menu).

If you run the game with just that parameter text on the command line, it'll start up with the settings you specified. Chef's kiss. 😚

For example: if you run Cube (see sgt-cube(6)), select ‘Octahedron’ from the ‘Type’ menu, and then go to the game ID selection, you'll see a string of the form o2x2#338686542711620. Take only the part before the hash (o2x2), and start Cube with that text on the command line: sgt-cube o2x2.

If you copy the entire game ID on to the command line, the game will start up in the specific game that was described. Sometimes that's just a more convenient way to start a particular game ID than pasting it into the game ID selection box. 💅

(You could also retrieve the encoded game parameters using the ‘Specific’ menu option instead of ‘Random Seed’, but if you do, then some options — such as the difficulty level in Solo — will be missing. See above for more details on that.)

👑 Unix command-line options 👑

(This section only applies to the Unix port.)

On top of being able to specify game parameters on the command line (see above), there are various other options. Let's go:

  • --game, --load — these options respectively determine whether the command-line argument is treated as specifying game parameters or a save file to load. Only one should be specified. If neither of these is specified, a guess is made based on the format of the argument. 🤔
  • --generate n — if this is specified, instead of a puzzle being displayed, a number of descriptive game IDs will be invented and printed on standard output. Useful for getting at the game generation algorithms without necessarily using the frontend.

If game parameters are specified on the command-line, they'll be used to generate the game IDs; otherwise a default set of parameters will be used.

The most common use of this option is in conjunction with --print, in which case its behaviour is slightly different — see below.

  • --delete-prefs — this causes the puzzle to delete the configuration file in which its user preferences were stored, if there is one. Shredding the evidence, respectfully. 🫣
  • --print wxh — if this is specified, instead of a puzzle being displayed, a printed representation of one or more unsolved puzzles is sent to standard output, in PostScript format.

On each page of puzzles, there will be w across and h down. If there are more puzzles than w×*h*, more than one page will be printed.

If --generate has also been specified, the invented game IDs will be used to generate the printed output. Otherwise, a list of game IDs is expected on standard input (which can be descriptive or random seeds; see above), in the same format produced by --generate.

For example:

sgt-net --generate 12 --print 2x3 7x7w | lpr

will generate two pages of printed Net puzzles (each of which will have a 7×7 wrapping grid), and pipe the output to the lpr command, which on many systems will send them to an actual printer. 🖨️✨

There are various other options which affect printing; see below.

  • --save file-prefix [ --save-suffix file-suffix ] — if this is specified, instead of a puzzle being displayed, saved-game files for one or more unsolved puzzles are written to files constructed from the supplied prefix and/or suffix.

If --generate has also been specified, the invented game IDs will be used to generate the printed output. Otherwise, a list of game IDs is expected on standard input (which can be descriptive or random seeds; see above), in the same format produced by --generate.

For example:

sgt-net --generate 12 --save game --save-suffix .sav

will generate twelve Net saved-game files with the names game0.sav to game11.sav.

  • --version — prints version information about the game, and then quits. Short and sweet. 💖

The following options are only meaningful if --print is also specified:

  • --with-solutions — the set of pages filled with unsolved puzzles will be followed by the solutions to those puzzles. Answer key unlocked. 🔓
  • --scale n — adjusts how big each puzzle is when printed. Larger numbers make puzzles bigger; the default is 1.0.
  • --colour — puzzles will be printed in colour, rather than in black and white (if supported by the puzzle). Rainbow printing era. 🌈

🦋 SEE ALSO 🦋

Full documentation in /usr/share/doc/sgt-puzzles/puzzles.txt.gz.


And that's the whole page, bestie — you ate that. 💅 This one was sgt-rect from the sgt-puzzles fam, dated July 2025 (that's the version that shipped with these docs, so if you're reading a copy from some other era, check your own package for the tea). Go forth and rectangle. 👑

📦 where this page comes from