sgt/puzzles
19 years agoMove the colour configuration into midend.c so that it becomes
simon [Wed, 18 May 2005 09:04:47 +0000 (09:04 +0000)]
Move the colour configuration into midend.c so that it becomes
cross-platform, and rename the environment variables so that they
follow the puzzle name. Should allow a static environment
configuration for each puzzle. Also introduced a <game>_PRESETS
variable for people whose favourite configuration isn't on the Type
menu by default.

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@5801 cda61777-01e9-0310-a592-d414129be87e

19 years agoStandalone solvers were broken by my recent API changes.
simon [Wed, 18 May 2005 08:34:01 +0000 (08:34 +0000)]
Standalone solvers were broken by my recent API changes.

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@5800 cda61777-01e9-0310-a592-d414129be87e

19 years agoUpdate doc for recent changes in Restart behaviour.
jacob [Tue, 17 May 2005 18:04:12 +0000 (18:04 +0000)]
Update doc for recent changes in Restart behaviour.

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@5799 cda61777-01e9-0310-a592-d414129be87e

19 years agoAfter much thought, I've decided that `Restart' on r is not a
simon [Tue, 17 May 2005 17:20:08 +0000 (17:20 +0000)]
After much thought, I've decided that `Restart' on r is not a
particularly useful keypress, particularly given how easy it is to
confuse it with `Redo'. So both r and ^R are now Redo, and Restart
is relegated to being a menu-only option.

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@5796 cda61777-01e9-0310-a592-d414129be87e

19 years agoNull-terminate generated Net/Netslide descriptive game IDs.
jacob [Tue, 17 May 2005 12:02:30 +0000 (12:02 +0000)]
Null-terminate generated Net/Netslide descriptive game IDs.

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@5794 cda61777-01e9-0310-a592-d414129be87e

19 years agoKeyboard shortcuts for Twiddle: abcdABCD in line with the notation
simon [Tue, 17 May 2005 11:53:42 +0000 (11:53 +0000)]
Keyboard shortcuts for Twiddle: abcdABCD in line with the notation
Gareth and I have been using to analyse the game, and also the
number pad. They don't work sensibly for all sizes, but they'll be
handy for the most common ones.

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@5793 cda61777-01e9-0310-a592-d414129be87e

19 years agoJust for Gareth: a means of overriding individual game colour
simon [Tue, 17 May 2005 11:47:33 +0000 (11:47 +0000)]
Just for Gareth: a means of overriding individual game colour
settings using environment variables. GTK frontend only, because
this is an unsupported (and unprincipled) hack.

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@5792 cda61777-01e9-0310-a592-d414129be87e

19 years ago`Restart' is now an undo-able action: it appends a move to the end
simon [Tue, 17 May 2005 11:46:55 +0000 (11:46 +0000)]
`Restart' is now an undo-able action: it appends a move to the end
of the undo list rather than destroying it. Partly this is because
accidental restarts are a real pain, and partly because it allows
you to compare the initial to the current state by restart-then-undo
which is handy in some puzzles.

In order to do this, I've introduced an additional per-entry field
in the undo list in the midend, which tracks which states were
created by `unusual' operations (Solve and Restart). The midend
takes care of suppressing animation and completion flashes during
transitions between a `special' state and its predecessor, relieving
the game backends of having to do it individually.

(This probably means I could remove some complexity in the
flash_time() functions in most backends, but I haven't done that in
this checkin.)

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@5791 cda61777-01e9-0310-a592-d414129be87e

19 years agocomment c'n'p error
jacob [Tue, 17 May 2005 11:00:15 +0000 (11:00 +0000)]
comment c'n'p error

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@5790 cda61777-01e9-0310-a592-d414129be87e

19 years agoCube's dup_game() function was missing a field. Oops.
simon [Tue, 17 May 2005 10:59:47 +0000 (10:59 +0000)]
Cube's dup_game() function was missing a field. Oops.

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@5789 cda61777-01e9-0310-a592-d414129be87e

19 years agoThe game IDs for Net (and Netslide) have always been random seeds
simon [Mon, 16 May 2005 18:57:09 +0000 (18:57 +0000)]
The game IDs for Net (and Netslide) have always been random seeds
rather than literal grid descriptions, which has always faintly
annoyed me because it makes it impossible to type in a grid from
another source. However, Gareth pointed out that short random-seed
game descriptions are useful, because you can read one out to
someone else without having to master the technology of cross-
machine cut and paste, or you can have two people enter the same
random seed simultaneously in order to race against each other to
complete the same puzzle. So both types of game ID seem to have
their uses.

Therefore, here's a reorganisation of the whole game ID concept.
There are now two types of game ID: one has a parameter string then
a hash then a piece of arbitrary random seed text, and the other has
a parameter string then a colon then a literal game description. For
most games, the latter is identical to the game IDs that were
previously valid; for Net and Netslide, old game IDs must be
translated into new ones by turning the colon into a hash, and
there's a new descriptive game ID format.

Random seed IDs are not guaranteed to be portable between software
versions (this is a major reason why I added version reporting
yesterday). Descriptive game IDs have a longer lifespan.

As an added bonus, I've removed the sections of documentation
dealing with game parameter encodings not shown in the game ID
(Rectangles expansion factor, Solo symmetry and difficulty settings
etc), because _all_ parameters must be specified in a random seed ID
and therefore users can easily find out the appropriate parameter
string for any settings they have configured.

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@5788 cda61777-01e9-0310-a592-d414129be87e

19 years agoMissed a vital semicolon off the Cygwin version.c makefile fragment.
simon [Sun, 15 May 2005 11:12:05 +0000 (11:12 +0000)]
Missed a vital semicolon off the Cygwin version.c makefile fragment.

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@5784 cda61777-01e9-0310-a592-d414129be87e

19 years agoEr, except that I already had a makedist.sh. Transferred new version
simon [Sun, 15 May 2005 10:58:09 +0000 (10:58 +0000)]
Er, except that I already had a makedist.sh. Transferred new version
code into that!

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@5783 cda61777-01e9-0310-a592-d414129be87e

19 years agoAdded automatic determination of the SVN revision number if a build
simon [Sun, 15 May 2005 10:52:23 +0000 (10:52 +0000)]
Added automatic determination of the SVN revision number if a build
takes place in a checked-out copy. Also added mkunxarc.sh which does
the same version determination before building its archive.

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@5782 cda61777-01e9-0310-a592-d414129be87e

19 years agoIntroduce a versioning mechanism, and an `About' box in all front
simon [Sun, 15 May 2005 10:31:11 +0000 (10:31 +0000)]
Introduce a versioning mechanism, and an `About' box in all front
ends. Versioning will be done solely by Subversion revision number,
since development on these puzzles is very incremental and gradual
and there don't tend to be obvious points to place numbered
releases.

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@5781 cda61777-01e9-0310-a592-d414129be87e

19 years agoI've had two complaints that Solo ought to recognise the numeric
simon [Thu, 12 May 2005 18:25:57 +0000 (18:25 +0000)]
I've had two complaints that Solo ought to recognise the numeric
keypad. The reason it doesn't is because front ends were carefully
translating the numeric keypad into 8-way directional keys for the
benefit of Cube. Therefore, a policy change:
 - front ends process the numeric keypad by sending MOD_NUM_KEYPAD |
   '3' and similar
 - front ends running on a platform with Num Lock SHOULD do this
   _irrespective_ of the state of Num Lock
 - back ends do whatever they see fit with numeric keypad keys.
Result: the numeric keypad now works in Solo, and also works in OS X
Cube (which it previously didn't because I forgot to implement that
bit of the front end!).

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@5774 cda61777-01e9-0310-a592-d414129be87e

19 years agoThe two Rubik-like puzzles, Sixteen and Twiddle, now support an
simon [Wed, 11 May 2005 20:38:10 +0000 (20:38 +0000)]
The two Rubik-like puzzles, Sixteen and Twiddle, now support an
additional configuration parameter, which is the number of shuffle
moves. By default the grid will be fully shuffled so that you need a
general solution algorithm to untangle it, but if you prefer you can
request a grid which has had (say) precisely four moves made on it,
and then attempt to exactly reverse those four moves.

Currently this feature is only available from the Custom box, and
not in any presets.

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@5769 cda61777-01e9-0310-a592-d414129be87e

19 years agoBah. Try the r5766 fix again, this time without the typo.
simon [Wed, 11 May 2005 18:49:42 +0000 (18:49 +0000)]
Bah. Try the r5766 fix again, this time without the typo.

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@5767 cda61777-01e9-0310-a592-d414129be87e

19 years agoCompletion flashes were occasionally failing to be cleaned up if a
simon [Wed, 11 May 2005 13:03:17 +0000 (13:03 +0000)]
Completion flashes were occasionally failing to be cleaned up if a
subsequent move animation began during them. Tracked this to
overenthusiastic use of clip() and fixed it.

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@5766 cda61777-01e9-0310-a592-d414129be87e

19 years agosolve_game() is passed the _initial_ game state, not the most recent
simon [Sat, 7 May 2005 16:07:26 +0000 (16:07 +0000)]
solve_game() is passed the _initial_ game state, not the most recent
one; so we can't just set `ret->completed = ret->movecount' and hope
it's been set to something other than zero. Instead, we set both
move counts to 1, which is entirely arbitrary but works.

This fixes a subtle bug with the Solve feature: if you pressed
Solve, then disturbed the grid, then brought it back to the solved
state by making more forward moves (rather than using Undo), then
the first time you did this the `Moves since auto-solve' status line
would reset to zero.

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@5759 cda61777-01e9-0310-a592-d414129be87e

19 years agoAdd 3x3 Trivial to the presets list, and make it the default.
simon [Sat, 7 May 2005 12:35:04 +0000 (12:35 +0000)]
Add 3x3 Trivial to the presets list, and make it the default.

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@5757 cda61777-01e9-0310-a592-d414129be87e

19 years agoAha, here's a nice easy way to generate really hard puzzles. Added
simon [Sat, 7 May 2005 12:30:29 +0000 (12:30 +0000)]
Aha, here's a nice easy way to generate really hard puzzles. Added
the missing fifth difficulty level to Solo: `Unreasonable', in which
even set-based reasoning is insufficient and there's no alternative
but to guess a number and backtrack if it didn't work. (Solutions
are still guaranteed unique, however.) In fact it now seems to take
less time to generate a puzzle of this grade than `Advanced'!

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@5756 cda61777-01e9-0310-a592-d414129be87e

19 years agoFix outdated comment
jacob [Wed, 4 May 2005 13:17:45 +0000 (13:17 +0000)]
Fix outdated comment

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@5744 cda61777-01e9-0310-a592-d414129be87e

19 years agoAllow for trailing '\0' in game_text_format() in various games.
jacob [Wed, 4 May 2005 12:56:04 +0000 (12:56 +0000)]
Allow for trailing '\0' in game_text_format() in various games.

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@5743 cda61777-01e9-0310-a592-d414129be87e

19 years agoThe Twiddle shuffling algorithm was theoretically parity-unbalanced:
simon [Wed, 4 May 2005 12:52:51 +0000 (12:52 +0000)]
The Twiddle shuffling algorithm was theoretically parity-unbalanced:
it performed a fixed number of shuffling moves, and on each one it
had a 2/3 chance of flipping the permutation parity and a 1/3 chance
of keeping it the same. Markov analysis shows that over a run of
1500-odd shuffle moves this will end up being an undetectably small
actual bias in the parity of the generated grid, but it offends my
sense of pedantry nonetheless so here's a small change to make the
number of shuffling moves itself have randomly chosen parity. The
parity of generated grids should now be _exactly_ 50:50.

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@5742 cda61777-01e9-0310-a592-d414129be87e

19 years agomarkup typo
jacob [Wed, 4 May 2005 12:24:16 +0000 (12:24 +0000)]
markup typo

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@5739 cda61777-01e9-0310-a592-d414129be87e

19 years agoI've changed my mind. For the benefit of users with slower
simon [Mon, 2 May 2005 16:59:50 +0000 (16:59 +0000)]
I've changed my mind. For the benefit of users with slower
computers, let's save the Solo and Pattern grids at generation time
and regurgitate them when asked to solve, rather than doing all the
work over again.

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@5737 cda61777-01e9-0310-a592-d414129be87e

19 years agoFix line endings when pasting on Windows.
simon [Mon, 2 May 2005 16:37:20 +0000 (16:37 +0000)]
Fix line endings when pasting on Windows.

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@5736 cda61777-01e9-0310-a592-d414129be87e

19 years agoAdd more useful ignores.
simon [Mon, 2 May 2005 13:41:34 +0000 (13:41 +0000)]
Add more useful ignores.

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@5735 cda61777-01e9-0310-a592-d414129be87e

19 years agoForgot to mention that you can undo a Solve operation.
simon [Mon, 2 May 2005 13:27:59 +0000 (13:27 +0000)]
Forgot to mention that you can undo a Solve operation.

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@5734 cda61777-01e9-0310-a592-d414129be87e

19 years agoAhem. The `Solve' option in orientable Twiddle needs to correct the
simon [Mon, 2 May 2005 13:22:25 +0000 (13:22 +0000)]
Ahem. The `Solve' option in orientable Twiddle needs to correct the
orientations as well as the order!

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@5733 cda61777-01e9-0310-a592-d414129be87e

19 years agoSilly (but harmless) typo.
simon [Mon, 2 May 2005 13:18:24 +0000 (13:18 +0000)]
Silly (but harmless) typo.

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@5732 cda61777-01e9-0310-a592-d414129be87e

19 years agoAdded an automatic `Solve' feature to most games. This is useful for
simon [Mon, 2 May 2005 13:17:10 +0000 (13:17 +0000)]
Added an automatic `Solve' feature to most games. This is useful for
various things:
 - if you haven't fully understood what a game is about, it gives
   you an immediate example of a puzzle plus its solution so you can
   understand it
 - in some games it's useful to compare your solution with the real
   one and see where you made a mistake
 - in the rearrangement games (Fifteen, Sixteen, Twiddle) it's handy
   to be able to get your hands on a pristine grid quickly so you
   can practise or experiment with manoeuvres on it
 - it provides a good way of debugging the games if you think you've
   encountered an unsolvable grid!

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@5731 cda61777-01e9-0310-a592-d414129be87e

19 years agoOops; forgot to check in the copy-to-clipboard option for Windows.
simon [Mon, 2 May 2005 10:55:32 +0000 (10:55 +0000)]
Oops; forgot to check in the copy-to-clipboard option for Windows.

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@5730 cda61777-01e9-0310-a592-d414129be87e

19 years agoIntroduce the concept of a `game_aux_info' structure. This is
simon [Mon, 2 May 2005 10:12:26 +0000 (10:12 +0000)]
Introduce the concept of a `game_aux_info' structure. This is
constructed at the same time as an internally generated game seed,
so that it can preserve any interesting information known by the
program at generation time but not physically contained within the
text of the game seed itself. (Such as, for example, the solution.)
Currently not used for anything yet, but it will be.

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@5729 cda61777-01e9-0310-a592-d414129be87e

19 years agoIt's actually vitally important, it turns out, to have all of the
simon [Mon, 2 May 2005 09:42:09 +0000 (09:42 +0000)]
It's actually vitally important, it turns out, to have all of the
`Cut', `Copy' and `Paste' items in the Edit menu of an OS X
application - because there's nothing else that enables the keyboard
cut/copy/paste shortcuts in an edit box! OS X Puzzles can now have
game IDs pasted into it, which it previously couldn't.

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@5728 cda61777-01e9-0310-a592-d414129be87e

19 years agoThe addition of a `Copy' menu item on OS X was really beginning to
simon [Sun, 1 May 2005 14:05:03 +0000 (14:05 +0000)]
The addition of a `Copy' menu item on OS X was really beginning to
strain my unconventional menu organisation, so I've reverted to
having `File' and `Edit' menus like everyone else.

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@5727 cda61777-01e9-0310-a592-d414129be87e

19 years agoCopy-to-clipboard for Rectangles.
simon [Sun, 1 May 2005 13:51:46 +0000 (13:51 +0000)]
Copy-to-clipboard for Rectangles.

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@5726 cda61777-01e9-0310-a592-d414129be87e

19 years agoCopy-to-clipboard facility for Fifteen, Sixteen and Twiddle.
simon [Sun, 1 May 2005 13:22:44 +0000 (13:22 +0000)]
Copy-to-clipboard facility for Fifteen, Sixteen and Twiddle.

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@5725 cda61777-01e9-0310-a592-d414129be87e

19 years agoIntroduced a new function in every game which formats a game_state
simon [Sun, 1 May 2005 12:53:41 +0000 (12:53 +0000)]
Introduced a new function in every game which formats a game_state
as text. This is used by front ends to implement copy-to-clipboard.
Currently the function does nothing (and is disabled) in every game
except Solo, but it's a start.

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@5724 cda61777-01e9-0310-a592-d414129be87e

19 years agoI can never remember what that `TRUE' means in the game structure
simon [Sun, 1 May 2005 11:07:13 +0000 (11:07 +0000)]
I can never remember what that `TRUE' means in the game structure
definitions, so let's move it so that it's just next to the
functions it relates to. This also opens the way for me to add more
booleans next to other functions without getting confused as to
which is which.

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@5723 cda61777-01e9-0310-a592-d414129be87e

19 years agoRemove outdated comment :-)
simon [Sun, 1 May 2005 10:57:47 +0000 (10:57 +0000)]
Remove outdated comment :-)

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@5722 cda61777-01e9-0310-a592-d414129be87e

19 years agoI think Windows fonts look better in bold as well.
simon [Sun, 1 May 2005 10:57:23 +0000 (10:57 +0000)]
I think Windows fonts look better in bold as well.

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@5721 cda61777-01e9-0310-a592-d414129be87e

19 years agoFix game IDs, which I broke in the orientability change. Also
simon [Sat, 30 Apr 2005 14:50:33 +0000 (14:50 +0000)]
Fix game IDs, which I broke in the orientability change. Also
introduce a sensible game ID notation for orientable games, and
finally (*blush*) turn the orientability triangles back the right
way up.

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@5718 cda61777-01e9-0310-a592-d414129be87e

19 years agoAfter brainstorming with Gareth, we've decided that this is a much
simon [Sat, 30 Apr 2005 14:38:20 +0000 (14:38 +0000)]
After brainstorming with Gareth, we've decided that this is a much
simpler and better way to indicate tile orientation than those
colour bars.

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@5717 cda61777-01e9-0310-a592-d414129be87e

19 years agoBah, and of course there's a TODO comment I forgot to remove.
simon [Sat, 30 Apr 2005 14:14:37 +0000 (14:14 +0000)]
Bah, and of course there's a TODO comment I forgot to remove.

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@5714 cda61777-01e9-0310-a592-d414129be87e

19 years agoTwiddle now has an additional mode in which tile orientation
simon [Sat, 30 Apr 2005 14:14:14 +0000 (14:14 +0000)]
Twiddle now has an additional mode in which tile orientation
matters. This mode is hard enough to scare the wossnames out of me,
but that's no reason not to put it in anyway!

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@5713 cda61777-01e9-0310-a592-d414129be87e

19 years agoAdd an ignore property.
simon [Sat, 30 Apr 2005 13:20:35 +0000 (13:20 +0000)]
Add an ignore property.

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@5711 cda61777-01e9-0310-a592-d414129be87e

19 years agoPango-derived fonts seem to generally look better if I ask for them
simon [Sat, 30 Apr 2005 13:11:22 +0000 (13:11 +0000)]
Pango-derived fonts seem to generally look better if I ask for them
in bold.

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@5709 cda61777-01e9-0310-a592-d414129be87e

19 years agoNew puzzle: `twiddle', generalised from a random door-unlocking
simon [Sat, 30 Apr 2005 12:54:22 +0000 (12:54 +0000)]
New puzzle: `twiddle', generalised from a random door-unlocking
gadget in Metroid Prime 2.

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@5708 cda61777-01e9-0310-a592-d414129be87e

19 years agoAdded a `--generate' command-line option in the GTK port of every
simon [Fri, 29 Apr 2005 17:07:19 +0000 (17:07 +0000)]
Added a `--generate' command-line option in the GTK port of every
puzzle, to make it construcct puzzle IDs and output them on stdout.
Also checked in print.py, a script which reads puzzle IDs on stdin
and produces PostScript output. With these, you can generate pages
of Pattern, Rectangles and Solo puzzles to take on trains with you.

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@5707 cda61777-01e9-0310-a592-d414129be87e

19 years agoCorrect block coordinate display when standalone solver shows its
simon [Fri, 29 Apr 2005 08:11:01 +0000 (08:11 +0000)]
Correct block coordinate display when standalone solver shows its
working.

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@5706 cda61777-01e9-0310-a592-d414129be87e

19 years agoAha, even better: a Makefile hack that causes auto-detection of GTK
simon [Thu, 28 Apr 2005 12:50:56 +0000 (12:50 +0000)]
Aha, even better: a Makefile hack that causes auto-detection of GTK
2 and fallback to GTK 1.2.

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@5705 cda61777-01e9-0310-a592-d414129be87e

19 years agoFix inconsistent vertical centring of text in GTK (and update Solo's
simon [Wed, 27 Apr 2005 19:44:34 +0000 (19:44 +0000)]
Fix inconsistent vertical centring of text in GTK (and update Solo's
todo list, which complained about this because Solo was the only
puzzle noticeably affected).

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@5694 cda61777-01e9-0310-a592-d414129be87e

19 years agoPatches for GTK 2. Puzzles already _built_ under GTK 2, but now it
simon [Wed, 27 Apr 2005 19:39:20 +0000 (19:39 +0000)]
Patches for GTK 2. Puzzles already _built_ under GTK 2, but now it
builds better:
 - the GTK makefile now defines $(GTK_CONFIG) which you can
   override, so you can build for GTK 2 with no makefile-editing
   simply by running `make GTK_CONFIG="pkg_config gtk+-2.0"'
 - we use Pango to find appropriate fonts, which means the text in
   the puzzles actually (gasp!) adapts its size to the
   circumstances. Unfortunately, I've been unable to do this
   portably without depending on _either_ a Pango function that
   isn't present in older versions _or_ the underlying window system
   being X11; I'd appreciate someone doing better.

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@5693 cda61777-01e9-0310-a592-d414129be87e

19 years agoCommand-line solver was dividing up non-square puzzles the wrong way
simon [Wed, 27 Apr 2005 16:59:18 +0000 (16:59 +0000)]
Command-line solver was dividing up non-square puzzles the wrong way
round.

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@5691 cda61777-01e9-0310-a592-d414129be87e

19 years agoPattern also contains an internal solver, so here's a command-line
simon [Wed, 27 Apr 2005 11:13:33 +0000 (11:13 +0000)]
Pattern also contains an internal solver, so here's a command-line
interface to it just in case it comes in handy.

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@5686 cda61777-01e9-0310-a592-d414129be87e

19 years agoThe command-line solver's difficulty gradings now use the same
simon [Tue, 26 Apr 2005 17:03:56 +0000 (17:03 +0000)]
The command-line solver's difficulty gradings now use the same
terminology as the puzzle GUI.

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@5683 cda61777-01e9-0310-a592-d414129be87e

19 years agoImplement the remaining modes of reasoning in nsolve, and thus
simon [Tue, 26 Apr 2005 11:19:00 +0000 (11:19 +0000)]
Implement the remaining modes of reasoning in nsolve, and thus
enable configurable puzzle difficulty. I'm only generating grids up
to Times level (complicated non-recursive analysis but guessing
never required); I wouldn't object to providing a Telegraph
difficulty level (guessing required) but it turns out to be very
hard indeed to generate at random. I might still add it later
(probably under the name `Unreasonable' :-) if I can think of an
efficient way to find them.

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@5682 cda61777-01e9-0310-a592-d414129be87e

19 years agoFix trivial UI glitch involving clicking on the border outside the
simon [Tue, 26 Apr 2005 08:20:25 +0000 (08:20 +0000)]
Fix trivial UI glitch involving clicking on the border outside the
grid. I'm really starting to get annoyed by the default round-
towards-zero behaviour of C integer division.

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@5681 cda61777-01e9-0310-a592-d414129be87e

19 years agoRemove some legacy debugging code which was breaking the MinGW
simon [Mon, 25 Apr 2005 14:37:33 +0000 (14:37 +0000)]
Remove some legacy debugging code which was breaking the MinGW
build, and which is redundant given the new standalone solver
functionality.

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@5672 cda61777-01e9-0310-a592-d414129be87e

19 years agoOops; _actually_ add the reasoning mode I mentioned in the last
simon [Mon, 25 Apr 2005 14:17:14 +0000 (14:17 +0000)]
Oops; _actually_ add the reasoning mode I mentioned in the last
checkin.

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@5671 cda61777-01e9-0310-a592-d414129be87e

19 years agoVarious changes prompted by my boss taking an interest:
simon [Mon, 25 Apr 2005 14:03:53 +0000 (14:03 +0000)]
Various changes prompted by my boss taking an interest:
 - added a compilation option -DSTANDALONE_SOLVER which makes both
   of Solo's internal solvers accessible from the command line.
 - fix a bug in nsolve turned up by testing in this mode: it failed
   to iterate at all! Oddly, this massive improvement to the
   effectiveness of nsolve hasn't emptied the generated grids by
   very much.
 - add an extra mode of reasoning to my to-do list (which is the
   dual of one already there, so I'm kicking myself).

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@5670 cda61777-01e9-0310-a592-d414129be87e

19 years agoOutstandingly cute mathematical transformation which allows me to
simon [Sun, 24 Apr 2005 10:06:47 +0000 (10:06 +0000)]
Outstandingly cute mathematical transformation which allows me to
lose a lot of code duplication in nsolve while preserving efficiency.

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@5667 cda61777-01e9-0310-a592-d414129be87e

19 years agoIntroduce configurable symmetry type in generated puzzles, and drop
simon [Sun, 24 Apr 2005 09:21:57 +0000 (09:21 +0000)]
Introduce configurable symmetry type in generated puzzles, and drop
the default symmetry from order-4 down to order-2, which seems to
mitigate the excessively-full-grid problem by permitting more
freedom to remove stuff.

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@5666 cda61777-01e9-0310-a592-d414129be87e

19 years agoDoc tweaks for Solo.
jacob [Sat, 23 Apr 2005 18:16:54 +0000 (18:16 +0000)]
Doc tweaks for Solo.

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@5665 cda61777-01e9-0310-a592-d414129be87e

19 years agoSimplify clip region handling under Windows, which also makes Solo's
simon [Sat, 23 Apr 2005 17:09:19 +0000 (17:09 +0000)]
Simplify clip region handling under Windows, which also makes Solo's
clipping policy work properly. I haven't proved why it didn't work
the previous way, but I have a good guess: I think that clip regions
are handled by reference. So I saved the old clip region out of the
DC, then did an IntersectClipRect, and then selected the old clip
region back in again - but the old clip region had never been
_de_-selected, because IntersectClipRect didn't change which object
was selected but rather it modified-in-place the one that already
was selected. So my attempt to restore the old clip region did
nothing whatsoever, and thus clipping to two different rectangles
during the same draw sequence failed. Now I'm completely destroying
the clip region during unclip(), which seems to work better.

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@5662 cda61777-01e9-0310-a592-d414129be87e

19 years agoVisual C points out a couple of typos.
simon [Sat, 23 Apr 2005 16:41:35 +0000 (16:41 +0000)]
Visual C points out a couple of typos.

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@5661 cda61777-01e9-0310-a592-d414129be87e

19 years agoInitial checkin of `Solo', the number-placing puzzle popularised by
simon [Sat, 23 Apr 2005 16:35:28 +0000 (16:35 +0000)]
Initial checkin of `Solo', the number-placing puzzle popularised by
the Times under the name `Sudoku'.

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@5660 cda61777-01e9-0310-a592-d414129be87e

19 years agoOops. Just noticed that the Windows front end completely ignores the
simon [Tue, 15 Mar 2005 14:24:45 +0000 (14:24 +0000)]
Oops. Just noticed that the Windows front end completely ignores the
`colour' parameter in draw_text().

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@5507 cda61777-01e9-0310-a592-d414129be87e

19 years agoStop the Pattern grid generation from generating an entire row or
simon [Thu, 24 Feb 2005 09:13:06 +0000 (09:13 +0000)]
Stop the Pattern grid generation from generating an entire row or
column of the same colour (at least when the dimensions are big
enough to make this feasible). It's a little bit too easy otherwise!

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@5391 cda61777-01e9-0310-a592-d414129be87e

19 years agoFixes in grid generation for pedantic special cases when one or both
simon [Thu, 24 Feb 2005 08:13:32 +0000 (08:13 +0000)]
Fixes in grid generation for pedantic special cases when one or both
grid dimensions are very small.

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@5390 cda61777-01e9-0310-a592-d414129be87e

19 years agoI've found NSView's setNeedsDisplayInRect: method, which is
simon [Sat, 5 Feb 2005 16:43:13 +0000 (16:43 +0000)]
I've found NSView's setNeedsDisplayInRect: method, which is
obviously better than just calling setNeedsDisplay on the whole
thing...

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@5258 cda61777-01e9-0310-a592-d414129be87e

19 years agoNeed to impose a _maximum_ width on edit boxes, as well as a minimum
simon [Tue, 25 Jan 2005 21:19:28 +0000 (21:19 +0000)]
Need to impose a _maximum_ width on edit boxes, as well as a minimum
width; if allowed to resize to the text within them, they look
terribly silly when containing an entire Rectangles or Pattern game
ID.

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@5210 cda61777-01e9-0310-a592-d414129be87e

19 years agoSanitising the mouse input data was a good idea, but my
simon [Tue, 25 Jan 2005 18:07:08 +0000 (18:07 +0000)]
Sanitising the mouse input data was a good idea, but my
implementation sucked. Revise it completely.

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@5209 cda61777-01e9-0310-a592-d414129be87e

19 years agoInclude code in midend.c to sanitise streams of mouse events so that
simon [Tue, 25 Jan 2005 14:07:46 +0000 (14:07 +0000)]
Include code in midend.c to sanitise streams of mouse events so that
back ends can be assured of always receiving them in a sensible
sequence (button-down, followed by zero or more drags, followed by
button-up, and never changing button in the middle of such a
sequence). I have a suspicion this issue was the cause of the
mysterious Pattern grid updates seen by Dan during testing last
night.

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@5208 cda61777-01e9-0310-a592-d414129be87e

19 years agoAhem. Lots of stuff, including the new OS X sources, was being left
simon [Tue, 25 Jan 2005 09:07:54 +0000 (09:07 +0000)]
Ahem. Lots of stuff, including the new OS X sources, was being left
out of the tarball by makedist.sh, causing the downloaded source
tree to fail mkfiles.pl. Worse still, the GTK Makefile wasn't
included, so people _needed_ to run mkfiles.pl! Both now fixed, I
think.

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@5205 cda61777-01e9-0310-a592-d414129be87e

19 years agoUpdates for OS X port (including updating copyright statements).
simon [Mon, 24 Jan 2005 15:45:37 +0000 (15:45 +0000)]
Updates for OS X port (including updating copyright statements).

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@5201 cda61777-01e9-0310-a592-d414129be87e

19 years agoAhem. Rogue copy and paste was causing preset menu items to go into
simon [Mon, 24 Jan 2005 14:10:16 +0000 (14:10 +0000)]
Ahem. Rogue copy and paste was causing preset menu items to go into
the Help menu rather than the Type menu. Fixed.

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@5199 cda61777-01e9-0310-a592-d414129be87e

19 years ago`make release' target, which builds a .dmg disk image in what
simon [Mon, 24 Jan 2005 13:44:24 +0000 (13:44 +0000)]
`make release' target, which builds a .dmg disk image in what
appears to be the approved Apple fashion.

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@5197 cda61777-01e9-0310-a592-d414129be87e

19 years agoHelp should have the shortcut Command-?.
simon [Mon, 24 Jan 2005 13:04:37 +0000 (13:04 +0000)]
Help should have the shortcut Command-?.

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@5195 cda61777-01e9-0310-a592-d414129be87e

19 years agoImprove OS X help: split back up into multiple files (thanks to
simon [Mon, 24 Jan 2005 13:00:11 +0000 (13:00 +0000)]
Improve OS X help: split back up into multiple files (thanks to
Halibut's new \cfg{html-local-head} directive), and add some CSS to
mimic the font choices of system help files.

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@5194 cda61777-01e9-0310-a592-d414129be87e

19 years agoThe #definition of COMBINED was done very badly: it was a piece of
simon [Mon, 24 Jan 2005 12:09:51 +0000 (12:09 +0000)]
The #definition of COMBINED was done very badly: it was a piece of
platform-dependent code in puzzles.h (ick), which in turn depended
on the magic symbol MAC_OS_X being defined by mkfiles.pl itself
(yuck). Suddenly realised I can do much better simply by putting it
in an OS X makefile extras section in Recipe, and removing both
previous hacks. Much nicer.

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@5191 cda61777-01e9-0310-a592-d414129be87e

19 years agoFirst cut at online help under OS X. I just built the HTML version
simon [Mon, 24 Jan 2005 12:05:21 +0000 (12:05 +0000)]
First cut at online help under OS X. I just built the HTML version
of the manual using Halibut (with one additional magic tag in the
<HEAD> section), stuck it in the right part of the application
bundle, referenced it in Info.plist, and added a Help menu.
Everything else was automatic. Not bad!

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@5190 cda61777-01e9-0310-a592-d414129be87e

19 years agoThe main grid outline in Pattern was asymmetric between the top/left
simon [Mon, 24 Jan 2005 10:50:17 +0000 (10:50 +0000)]
The main grid outline in Pattern was asymmetric between the top/left
edges and the bottom/right ones. Fix it. (Also remove it from the
todo list in osx.m, where I had entered it in the assumption that it
was a bug in my new OS X port! Turns out it's an entirely platform-
independent bug.)

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@5187 cda61777-01e9-0310-a592-d414129be87e

19 years agoFix two window-resizing bugs introduced by the addition of the status bar.
simon [Mon, 24 Jan 2005 10:45:23 +0000 (10:45 +0000)]
Fix two window-resizing bugs introduced by the addition of the status bar.

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@5186 cda61777-01e9-0310-a592-d414129be87e

19 years agoImprove fatal error handling.
simon [Mon, 24 Jan 2005 10:35:54 +0000 (10:35 +0000)]
Improve fatal error handling.

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@5185 cda61777-01e9-0310-a592-d414129be87e

19 years agoAdded a dock menu which makes it more convenient to launch a new
simon [Mon, 24 Jan 2005 07:42:01 +0000 (07:42 +0000)]
Added a dock menu which makes it more convenient to launch a new
game window.

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@5184 cda61777-01e9-0310-a592-d414129be87e

19 years agoStatus bar support.
simon [Mon, 24 Jan 2005 07:37:50 +0000 (07:37 +0000)]
Status bar support.

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@5183 cda61777-01e9-0310-a592-d414129be87e

19 years agoImplemented the configurable dialog box mechanism, allowing custom
simon [Sun, 23 Jan 2005 22:28:18 +0000 (22:28 +0000)]
Implemented the configurable dialog box mechanism, allowing custom
game sizes and entering of specific game IDs. I think this is now a
plausibly usable port, even if still by no means _finished_.

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@5182 cda61777-01e9-0310-a592-d414129be87e

19 years agoAdded a framework for putting things other than the binary into a
simon [Sun, 23 Jan 2005 11:20:31 +0000 (11:20 +0000)]
Added a framework for putting things other than the binary into a
Mac OS X application bundle, and provided an icon for Puzzles.

Also renamed the OS X source file from macosx.m to osx.m, so that it
can sit beside other things such as osx-info.plist and not cause
enormously long filenames.

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@5179 cda61777-01e9-0310-a592-d414129be87e

19 years agoAh, no, _that_ fixes the malloc problem. I'd forgotten that midend.c
simon [Sun, 23 Jan 2005 09:59:45 +0000 (09:59 +0000)]
Ah, no, _that_ fixes the malloc problem. I'd forgotten that midend.c
already takes care of managing the allocation of game presets, so
there's no need for me to introduce scary ObjC machinery to do so in
the frontend.

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@5178 cda61777-01e9-0310-a592-d414129be87e

19 years agoI _think_ this has just fixed an uninitialised-memory bug, but I'm
simon [Sun, 23 Jan 2005 09:37:16 +0000 (09:37 +0000)]
I _think_ this has just fixed an uninitialised-memory bug, but I'm
not sure.

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@5177 cda61777-01e9-0310-a592-d414129be87e

19 years agoDynamically frob the menu bar to achieve selection of game presets.
simon [Sun, 23 Jan 2005 09:17:46 +0000 (09:17 +0000)]
Dynamically frob the menu bar to achieve selection of game presets.

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@5176 cda61777-01e9-0310-a592-d414129be87e

19 years agoFlesh out the menus a bit.
simon [Sun, 23 Jan 2005 08:36:24 +0000 (08:36 +0000)]
Flesh out the menus a bit.

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@5175 cda61777-01e9-0310-a592-d414129be87e

19 years agoUpdate TODO.
simon [Sat, 22 Jan 2005 18:46:51 +0000 (18:46 +0000)]
Update TODO.

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@5174 cda61777-01e9-0310-a592-d414129be87e

19 years agoInitial checkin of a Mac OS X port of puzzles, using Cocoa. All
simon [Sat, 22 Jan 2005 18:34:18 +0000 (18:34 +0000)]
Initial checkin of a Mac OS X port of puzzles, using Cocoa. All
puzzles are compiled together into a single monolithic application
which allows you to select each one from one of its menus.

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@5173 cda61777-01e9-0310-a592-d414129be87e

19 years agoArrange that we really _can_ compile all the puzzles into a single
simon [Sat, 22 Jan 2005 15:29:01 +0000 (15:29 +0000)]
Arrange that we really _can_ compile all the puzzles into a single
binary if we choose: fix bugs in cube.c and sixteen.c that manifest
when compiled that way, and introduce list.c which provides a global
list of all the available puzzles.

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@5169 cda61777-01e9-0310-a592-d414129be87e

19 years agoRather than each game backend file exporting a whole load of
simon [Mon, 17 Jan 2005 13:48:57 +0000 (13:48 +0000)]
Rather than each game backend file exporting a whole load of
functions and a couple of variables, now each one exports a single
structure containing a load of function pointers and said variables.
This should make it easy to support platforms on which it's sensible
to compile all the puzzles into a single monolithic application. The
two existing platforms are still one-binary-per-game.

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@5126 cda61777-01e9-0310-a592-d414129be87e

19 years agoAdd a `jumble' key (`J') to Net, which scrambles the positions of all unlocked
jacob [Wed, 22 Dec 2004 19:27:26 +0000 (19:27 +0000)]
Add a `jumble' key (`J') to Net, which scrambles the positions of all unlocked
tiles randomly. (Rachel asked for this; it's been being tested for a good few
months now, and Simon didn't care either way, so in it goes :)

As part of this, the front end can now be asked to provide a random random
seed (IYSWIM).

git-svn-id: svn://svn.tartarus.org/sgt/puzzles@5019 cda61777-01e9-0310-a592-d414129be87e