Last updated 2013 July 23
psudoku is software to generate Sudoku puzzles of various sizes, geometries, and levels of difficulty, in various print-friendly layouts, as PostScript (.ps) files. These can then be easily converted to PDFs using the ps2pdf utility. C++ source code is provided under the GPL (GNU Public Licence). (Commercial licensing and custom work on the software are possible; contact plüto@prójêctpluto.cöm if interested.)
However, the puzzles themselves may be used freely (see the blurb inserted near the puzzle solutions for details.) You can click here to download the source code (about 28 KBytes). If you're not a programmer and just want some Sudoku to solve, here are 80 pages of medium-level, "normal" 9x9 puzzles. (Plus some other examples below that may be of interest.)
It can be compiled as either...
g++ -Wall -O3 -o psudoku psudoku.cpp cl -W4 -Ox psudoku.cpp wcl386 -zq -W4 -Ox -k1000000 psudoku.cpp
...for g++, Microsoft C/C++, or OpenWATCOM, with modest changes for the compiler of your choice. (I've run it in DOS/Windows and Linux.) Here are some examples of what it produces:
• One-page, single 24x24 Sudoku of unusual geometry; solutions shown upside-down at bottom of page. Produced with ./psudoku -g24a -ttemplat0.ps
• One-page, four 16x16 Sudoku; solutions shown upside-down at bottom of page. Produced with ./psudoku -g16 -ttemplat1.ps
• Four-page, 36 alternative-layout 8x8 Sudoku of medium difficulty; twelve puzzles per page, all solutions on fourth page. Produced with ./psudoku -m5 -g8b
• Four-page, 18 "standard" 9x9 Sudoku of high difficulty; six puzzles per page, all solutions on fourth page. This was run with ./psudoku -m12 -g9 . "m12" means that method 12 was used, i.e., at some point, the code had to make a guess between two possibilities.
• Single page of four 17x17 Sudoku. Produced with ./psudoku -m1 -g17 -ttemplat1.ps
• 80 pages of "standard" 9x9 Sudoku of medium difficulty; six puzzles per page, solutions every fourth page. This was created with ./psudoku -m5 -n20 , i.e., use the default four-page format, but repeat it twenty times. Hence the eighty pages.
Command-line options:
-g<grid name> By default, this program selects the '9' grid: the standard 9x9 grid divided into nine 3x3 subgrids. One can select, for example, the '12' grid (12x12 split into twelve 3x4 grids), or the '16' (16x16 grid split into sixteen 4x4 grids), as well as a variety of less usual grid types, in sizes from 4x4 to 36x36. (In theory, one could continue up to a 63x63 grid, that limit being set by the size of a 64-bit long integer. In practice, things get slow somewhere around a 30x30 grid, and I think it's worse than an exponential slowdown with size.)
Note that, as the 13x13 example at left shows (using the usual digits 1-9 plus 0, A, B, and C), shapes may get strange for odd sizes. However, the usual rules -- each symbol used once per line, column, and boxed-in region -- still apply.
If you look at the file sud_grp.txt , you'll see what grid types are available and how to create new ones.
-x Causes the program to create "diagonal Sudoku", a.k.a. "Sudoku-X": puzzles wherein, in addition to the usual rules for a Sudoku, each number occurs only once in each diagonal.
-c<characters> By default, the digits 1-9 will be used in the puzzle. (For larger grids, 0 will be used, then A, B, C, etc., up to Z, with I and O omitted.) With this option, one could, for example, select -cABCDEFGHI to use the first letters instead of the first numbers; or -c012345678 to select zero-based numbering instead of one-based numbering.
-t<template filename> The output will be formatted using the specified template file. You can choose, for example, to output four Sudoku on one page with the answers shown upside-down at the bottom of the page; or to produce three pages of six Sudoku each, with a fourth page of solutions; and so on.
-n<n_repeats> Causes the output file to contain 'n_repeats'
of the desired puzzles. For example,
psudoku -n7
would (assuming the default template) result in a 28-page output: three
pages of puzzles, one of solutions, then three more of puzzles, one of
solutions, and so on. Currently available template files are :
• template.ps: The default arrangement. Three pages of six Sudoku each, arranged two across and three vertically; on the fourth page, all 18 solutions.
• templat3.ps: Three pages of a dozen Sudoku each, arranged three across and four vertically; on the fourth page, all 36 solutions.
• templat1.ps: One page, with four Sudoku shown in a 2x2 array, with solutions shown upside-down at the bottom. This is well-suited to "medium" grids of the 16x16 variety, for example. For smaller grids, you can use a different template and get more puzzles per page.
• templat0.ps: One page, single Sudoku, with its solution shown upside-down at the bottom. This is well-suited to "huge" grids of the 30x30 variety, for example. For smaller grids, you can use a different template and get more puzzles per page.
-m<method> Selects the maximum 'method' used, and therefore, the level of difficulty. -m1 means the puzzle can be solved by just finding singletons; -m2 means one will also have to find one or more single candidates; and so on, up to -m12 (meaning that at some point, you'll have to make a guess between two alternatives. However, psudoku doesn't use some advanced methods such as Jellyfish, so it's conceivable that even a level 12 puzzle could be solved without guessing.)