Initial checkin of `Solo', the number-placing puzzle popularised by

the Times under the name `Sudoku'.

[originally from svn r5660]
This commit is contained in:
Simon Tatham
2005-04-23 16:35:28 +00:00
parent 134418abf7
commit 0c55b7e16f
5 changed files with 1565 additions and 9 deletions

4
Recipe
View File

@ -18,7 +18,7 @@ COMMON = midend misc malloc random
NET = net tree234 NET = net tree234
NETSLIDE = netslide tree234 NETSLIDE = netslide tree234
ALL = list NET NETSLIDE cube fifteen sixteen rect pattern ALL = list NET NETSLIDE cube fifteen sixteen rect pattern solo
net : [X] gtk COMMON NET net : [X] gtk COMMON NET
netslide : [X] gtk COMMON NETSLIDE netslide : [X] gtk COMMON NETSLIDE
@ -27,6 +27,7 @@ fifteen : [X] gtk COMMON fifteen
sixteen : [X] gtk COMMON sixteen sixteen : [X] gtk COMMON sixteen
rect : [X] gtk COMMON rect rect : [X] gtk COMMON rect
pattern : [X] gtk COMMON pattern pattern : [X] gtk COMMON pattern
solo : [X] gtk COMMON solo
# The Windows Net shouldn't be called `net.exe' since Windows # The Windows Net shouldn't be called `net.exe' since Windows
# already has a reasonably important utility program by that name! # already has a reasonably important utility program by that name!
@ -37,6 +38,7 @@ fifteen : [G] WINDOWS COMMON fifteen
sixteen : [G] WINDOWS COMMON sixteen sixteen : [G] WINDOWS COMMON sixteen
rect : [G] WINDOWS COMMON rect rect : [G] WINDOWS COMMON rect
pattern : [G] WINDOWS COMMON pattern pattern : [G] WINDOWS COMMON pattern
solo : [G] WINDOWS COMMON solo
# Mac OS X unified application containing all the puzzles. # Mac OS X unified application containing all the puzzles.
Puzzles : [MX] osx osx.icns osx-info.plist COMMON ALL Puzzles : [MX] osx osx.icns osx-info.plist COMMON ALL

2
list.c
View File

@ -24,6 +24,7 @@ extern const game netslide;
extern const game pattern; extern const game pattern;
extern const game rect; extern const game rect;
extern const game sixteen; extern const game sixteen;
extern const game solo;
const game *gamelist[] = { const game *gamelist[] = {
&cube, &cube,
@ -33,6 +34,7 @@ const game *gamelist[] = {
&pattern, &pattern,
&rect, &rect,
&sixteen, &sixteen,
&solo,
}; };
const int gamecount = lenof(gamelist); const int gamecount = lenof(gamelist);

View File

@ -18,6 +18,8 @@
\cfg{ps-filename}{puzzles.ps} \cfg{ps-filename}{puzzles.ps}
\cfg{pdf-filename}{puzzles.pdf} \cfg{pdf-filename}{puzzles.pdf}
\define{by} \u00D7{x}
This is a collection of small one-player puzzle games. This is a collection of small one-player puzzle games.
\copyright This manual is copyright 2004 Simon Tatham. All rights \copyright This manual is copyright 2004 Simon Tatham. All rights
@ -311,13 +313,13 @@ respectively.
\cfg{winhelp-topic}{games.fifteen} \cfg{winhelp-topic}{games.fifteen}
The old ones are the best: this is the good old \q{\i{15-puzzle}} with The old ones are the best: this is the good old \q{\i{15-puzzle}}
sliding tiles. You have a 4x4 square grid; 15 squares contain numbered with sliding tiles. You have a 4\by\.4 square grid; 15 squares
tiles, and the sixteenth is empty. Your move is to choose a tile next contain numbered tiles, and the sixteenth is empty. Your move is to
to the empty space, and slide it into the space. The aim is to end up choose a tile next to the empty space, and slide it into the space.
with the tiles in numerical order, with the space in the bottom right The aim is to end up with the tiles in numerical order, with the
(so that the top row reads 1,2,3,4 and the bottom row reads space in the bottom right (so that the top row reads 1,2,3,4 and the
13,14,15,\e{space}). bottom row reads 13,14,15,\e{space}).
\H{fifteen-controls} \i{Fifteen controls} \H{fifteen-controls} \i{Fifteen controls}
@ -446,7 +448,7 @@ command-line configuration
The expansion factor parameter, described in \k{rectangles-params}, The expansion factor parameter, described in \k{rectangles-params},
is not mentioned by default in the game ID (see \k{common-id}). So is not mentioned by default in the game ID (see \k{common-id}). So
if you set your expansion factor to (say) 0.75, and then you if you set your expansion factor to (say) 0.75, and then you
generate an 11x11 grid, then the game ID will simply say generate an 11\by\.11 grid, then the game ID will simply say
\c{11x11:}\e{numbers}. This means that if you send the game ID to \c{11x11:}\e{numbers}. This means that if you send the game ID to
another player and they paste it into their copy of Rectangles, another player and they paste it into their copy of Rectangles,
their game will not be automatically configured to use the same their game will not be automatically configured to use the same
@ -528,6 +530,54 @@ grey.
The only options available from the \q{Custom...} option on the \q{Type} The only options available from the \q{Custom...} option on the \q{Type}
menu are \e{Width} and \e{Height}, which are self-explanatory. menu are \e{Width} and \e{Height}, which are self-explanatory.
\C{solo} \i{Solo}
\cfg{winhelp-topic}{games.solo}
You have a square grid, which is divided into square or rectangular
blocks. Each square must be filled in with a digit from 1 to the
size of the grid, in such a way that
\b every row contains only one occurrence of each digit
\b every column contains only one occurrence of each digit
\b every block contains only one occurrence of each digit.
You are given some of the numbers as clues; your aim is to place the
rest of the numbers correctly.
The default puzzle size is 3\by\.3 (a 9\by\.9 actual grid, divided
into nine 3\by\.3 blocks). You can also select sizes with
rectangular blocks instead of square ones, such as 2\by\.3 (a
6\by\.6 grid divided into six 3\by\.2 blocks).
If you select a puzzle size which requires more than 9 digits, the
additional digits will be letters of the alphabet. For example, if
you select 3\by\.4 then the digits which go in your grid will be 1
to 9, plus \cq{a}, \cq{b} and \cq{c}.
I first saw this puzzle in \i{Nikoli} \k{nikoli}, although it's also
been popularised by various newspapers under the name \q{Sudoku} or
\q{Su Doku}.
\H{solo-controls} \I{controls, for Solo}Solo controls
To play Solo, simply click the mouse in any empty square and then
type a digit or letter on the keyboard to fill that square. If you
make a mistake, click the mouse in the incorrect square and press
Space to clear it again (or use the Undo feature).
(All the actions described in \k{common-actions} are also available.)
\H{solo-parameters} \I{parameters, for Solo}Solo parameters
Solo allows you to configure two separate dimensions of the puzzle
grid: the number of columns, and the number of rows, into which the
main grid is divided. (The size of a block is the inverse of this:
for example, if you select 2 columns and 3 rows, each actual block
will have 3 columns and 2 rows.)
\A{licence} \I{MIT licence}\ii{Licence} \A{licence} \I{MIT licence}\ii{Licence}
This software is \i{copyright} 2004-2005 Simon Tatham. This software is \i{copyright} 2004-2005 Simon Tatham.

View File

@ -14,6 +14,9 @@
#define lenof(array) ( sizeof(array) / sizeof(*(array)) ) #define lenof(array) ( sizeof(array) / sizeof(*(array)) )
#define STR_INT(x) #x
#define STR(x) STR_INT(x)
enum { enum {
LEFT_BUTTON = 0x1000, LEFT_BUTTON = 0x1000,
MIDDLE_BUTTON, MIDDLE_BUTTON,

1499
solo.c Normal file

File diff suppressed because it is too large Load Diff