chiark / gitweb /
sgt-puzzles.git
18 years agoJust noticed yesterday that initial window sizing is broken on
Simon Tatham [Sat, 18 Jun 2005 08:52:50 +0000 (08:52 +0000)]
Just noticed yesterday that initial window sizing is broken on
Windows for puzzles with status bars, because the initial call to
check_window_size is given the window size _without_ the status bar
and assumes that that has to be big enough for the whole thing
_with_ the status bar, so it shrinks everything by a little bit. So
now we resize the window to take account of the status bar before
calling check_window_size(), and the problem seems to have gone away.

[originally from svn r5975]

18 years agoI've decided I didn't like the asymmetry of putting the solution
Simon Tatham [Sat, 18 Jun 2005 08:46:33 +0000 (08:46 +0000)]
I've decided I didn't like the asymmetry of putting the solution
markers in the top left of the square.

[originally from svn r5974]

18 years agoI'm sick of not having a `make install' target.
Simon Tatham [Sat, 18 Jun 2005 08:36:52 +0000 (08:36 +0000)]
I'm sick of not having a `make install' target.

[originally from svn r5973]

18 years agoCorrect rogue chapter into a subheading.
Simon Tatham [Fri, 17 Jun 2005 19:06:25 +0000 (19:06 +0000)]
Correct rogue chapter into a subheading.

[originally from svn r5972]

18 years agoSolver for Flip.
Simon Tatham [Fri, 17 Jun 2005 18:55:36 +0000 (18:55 +0000)]
Solver for Flip.

[originally from svn r5970]

18 years agoInfrastructure change which I've been thinking about for a while:
Simon Tatham [Fri, 17 Jun 2005 18:54:58 +0000 (18:54 +0000)]
Infrastructure change which I've been thinking about for a while:
the back end function solve_game() now takes the _current_
game_state in addition to the initial one.

[originally from svn r5969]

18 years agoAnimation.
Simon Tatham [Fri, 17 Jun 2005 17:32:28 +0000 (17:32 +0000)]
Animation.

[originally from svn r5968]

18 years agoAnother new puzzle! This one isn't particularly deep or complex
Simon Tatham [Fri, 17 Jun 2005 17:16:49 +0000 (17:16 +0000)]
Another new puzzle! This one isn't particularly deep or complex
(solving it only requires matrix inversion over GF(2), whereas
several of the other puzzles in this collection are NP-complete in
principle), but it's a fun enough thing to play with and is
non-trivial to do in your head - especially on the hardest preset.

[originally from svn r5967]

18 years agoAn email conversation with Chuck Fresno turned up several forms of
Simon Tatham [Fri, 17 Jun 2005 11:51:52 +0000 (11:51 +0000)]
An email conversation with Chuck Fresno turned up several forms of
symmetry which were not implemented in Solo. Now they are.

In the process I've completely retired symmetry_limit() on the
grounds that some of the new symmetries do not have a rectangular
base region; instead I determine the base region by going through
the grid and finding every square which is not transformed into a
lexicographically lower square by any symmetry operation. This means
that adding new symmetries is now _only_ a matter of encoding the
actual transformation rules.

[originally from svn r5965]

18 years agoClean up the behaviour of drags off the edge of the grid. These have
Simon Tatham [Fri, 10 Jun 2005 13:05:24 +0000 (13:05 +0000)]
Clean up the behaviour of drags off the edge of the grid. These have
always been a convenient way to cancel a drag you decided was an
error, but now it's more obvious that this is the case.

[originally from svn r5941]

18 years agoDisable shuffle overlap checking in the special case w=h=n.
Simon Tatham [Fri, 10 Jun 2005 11:34:02 +0000 (11:34 +0000)]
Disable shuffle overlap checking in the special case w=h=n.

[originally from svn r5940]

18 years agoOverzealous last-move tracking during shuffle was causing lockups on
Simon Tatham [Fri, 10 Jun 2005 11:29:59 +0000 (11:29 +0000)]
Overzealous last-move tracking during shuffle was causing lockups on
2x2 grid generation.

[originally from svn r5939]

18 years agoPatch from James Harvey to rearrange the Same Game colours.
Simon Tatham [Fri, 10 Jun 2005 11:27:26 +0000 (11:27 +0000)]
Patch from James Harvey to rearrange the Same Game colours.

[originally from svn r5938]

18 years agoPatch from Chris Emerson to add a status bar to Rectangles. Apart
Simon Tatham [Fri, 10 Jun 2005 11:24:44 +0000 (11:24 +0000)]
Patch from Chris Emerson to add a status bar to Rectangles. Apart
from saying `Auto-solved' or `Completed', the main function of the
status bar is to track the current size of a rectangle you're
dragging out, which makes life much easier when trying to count up
large rectangles in 19x19 mode.

[originally from svn r5937]

18 years agoGDK 2.6, in its doubtless infinite wisdom, has decided that
Simon Tatham [Thu, 9 Jun 2005 18:29:11 +0000 (18:29 +0000)]
GDK 2.6, in its doubtless infinite wisdom, has decided that
gdk_font_from_description() will no longer even _try_ to return a
font matching the specified Pango font description; instead it will
return `fixed' no matter what you do. Therefore, I've had to switch
to using Pango proper for Puzzles text rendering, rather than just
using Pango for font selection.

[originally from svn r5936]

18 years agoRemove debug output.
Jacob Nevins [Wed, 8 Jun 2005 09:20:35 +0000 (09:20 +0000)]
Remove debug output.

[originally from svn r5926]

18 years agoAdd Windows help topic
Jacob Nevins [Tue, 7 Jun 2005 21:05:29 +0000 (21:05 +0000)]
Add Windows help topic

[originally from svn r5923]

18 years agoTweaks and more complete documentation for Same Game.
Jacob Nevins [Tue, 7 Jun 2005 21:03:14 +0000 (21:03 +0000)]
Tweaks and more complete documentation for Same Game.

[originally from svn r5922]

18 years agoInteger overflow in game_size(). Oops.
Simon Tatham [Tue, 7 Jun 2005 20:44:14 +0000 (20:44 +0000)]
Integer overflow in game_size(). Oops.

[originally from svn r5921]

18 years agoChris Emerson points out that gtk_window_resize() isn't in GTK 1.2.
Simon Tatham [Tue, 7 Jun 2005 20:25:25 +0000 (20:25 +0000)]
Chris Emerson points out that gtk_window_resize() isn't in GTK 1.2.
Work around it the same way I did in PuTTY.

[originally from svn r5920]

18 years agoJames Harvey's patch to support keyboard control in Same Game.
Simon Tatham [Tue, 7 Jun 2005 20:22:25 +0000 (20:22 +0000)]
James Harvey's patch to support keyboard control in Same Game.

[originally from svn r5919]

18 years agoForgot to add Same Game to the big list for OS X.
Simon Tatham [Tue, 7 Jun 2005 20:22:08 +0000 (20:22 +0000)]
Forgot to add Same Game to the big list for OS X.

[originally from svn r5918]

18 years agoJames Harvey (again) points out an array underrun in the new
Simon Tatham [Tue, 7 Jun 2005 19:07:58 +0000 (19:07 +0000)]
James Harvey (again) points out an array underrun in the new
clash-checking code in Solo. (valgrind confirms it.)

[originally from svn r5916]

18 years agoAnother James Harvey patch. This one introduces a new button code
Simon Tatham [Tue, 7 Jun 2005 19:04:52 +0000 (19:04 +0000)]
Another James Harvey patch. This one introduces a new button code
called `CURSOR_SELECT', intended for platforms which have a fire
button to go with their cursor keys. (Apparently some Palms do.)
CURSOR_SELECT is not bound to anything on any of the current three
platforms, and therefore no game may rely on it being available.
This checkin adds it in Net as a synonym for 'a', the keyboard-based
rotate-left command.

[originally from svn r5915]

18 years agoJames Harvey has contributed an implementation of `Same Game', also
Simon Tatham [Tue, 7 Jun 2005 19:01:36 +0000 (19:01 +0000)]
James Harvey has contributed an implementation of `Same Game', also
known as ksame (KDE) and Same GNOME (GNOME).

[originally from svn r5914]

18 years agoAll the games in this collection have always defined their graphics
Simon Tatham [Tue, 7 Jun 2005 17:57:50 +0000 (17:57 +0000)]
All the games in this collection have always defined their graphics
in terms of a constant TILE_SIZE (or equivalent). Here's a
surprisingly small patch which switches this constant into a
run-time variable.

The only observable behaviour change should be on Windows, which
physically does not permit the creation of windows larger than the
screen; if you try to create a puzzle (Net makes this plausible)
large enough to encounter this restriction, the Windows front end
should automatically re-adjust the puzzle's tile size so that it
does fit within the available space.

On GTK, I haven't done this, on the grounds that X _does_ permit
windows larger than the screen, and many X window managers already
provide the means to navigate around such a window. Gareth said he'd
rather navigate around a huge Net window than have it shrunk to fit
on one screen. I'm uncertain that this makes sense for all puzzles -
Pattern in particular strikes me as something that might be better
off shrunk to fit - so I may have to change policy later or make it
configurable.

On OS X, I also haven't done automatic shrinkage to fit on one
screen, largely because I didn't have the courage to address the
question of multiple monitors and what that means for the entire
concept :-)

[originally from svn r5913]

18 years agoIntroduce a new game backend function (there seem to have been a lot
Simon Tatham [Mon, 6 Jun 2005 11:21:36 +0000 (11:21 +0000)]
Introduce a new game backend function (there seem to have been a lot
of these recently) whose job is to update a game_ui to be consistent
with a new game_state. This is called by midend.c in every situation
where the current game_state changes _other_ than as a result of
make_move (Undo, Redo, Restart, Solve).

The introduction of this function allows a game_ui to contain
information about selections or highlights within a game_state which
simply wouldn't make sense when transferred to another game_state.
In particular, I've used it to fix a subtle bug in Solo whereby,
although you couldn't right-click to pencil-mode highlight a filled
square, you could _get_ a pencil-mode highlight in a filled square
if you used Undo and Redo. (Undo to before the square was filled,
right-click to highlight it, then Redo. Alternatively, left-click
and clear the square, right-click to highlight it, then Undo.)

[originally from svn r5912]

18 years agoSmall UI bug: LEFT_RELEASEs were being thrown away completely if
Simon Tatham [Sat, 4 Jun 2005 17:51:49 +0000 (17:51 +0000)]
Small UI bug: LEFT_RELEASEs were being thrown away completely if
their coordinates were outside the playing area. Clearly no actual
move should be made in that situation, but we do at least need to
sort out any highlighted squares from the prior dragging operations.

[originally from svn r5911]

18 years agoRevamp pencil mark placement and sizing. Pencil marks are now sized
Simon Tatham [Sat, 4 Jun 2005 12:32:40 +0000 (12:32 +0000)]
Revamp pencil mark placement and sizing. Pencil marks are now sized
and positioned according to how many there are in the cell, rather
than how many distinct digits there are in the entire puzzle. This
means that 4x4 Solo can now be played with pencil marks without
_too_ much difficulty; the marks will still get a bit crowded if you
have more than 12 in the same square, but with luck that shouldn't
happen often, and as long as you're down in the 2-9 range things
should be entirely legible.

[originally from svn r5909]

18 years agoJames Harvey requested that puzzles not use DEBUG as a preprocessor
Simon Tatham [Sat, 4 Jun 2005 09:59:03 +0000 (09:59 +0000)]
James Harvey requested that puzzles not use DEBUG as a preprocessor
symbol for enabling diagnostics, presumably because in his Palm port
it means something else as well. He sent this patch to switch Net
and Netslide over to using GENERATION_DIAGNOSTICS, in the fashion of
the newer games.

[originally from svn r5908]

18 years agoColin Watson suggests that Alt-click (or Option-click) could
Simon Tatham [Fri, 3 Jun 2005 12:27:29 +0000 (12:27 +0000)]
Colin Watson suggests that Alt-click (or Option-click) could
usefully be equivalent to right-clicking on platforms other than OS
X; in particular, it's useful if you're running Linux on Apple
hardware such as PowerBook which inherently has only one button. So
here's the fix for GTK, and Windows as well (the latter for
completeness and consistency, not because I can actually think of
any reason somebody might be running Windows on one-button
hardware).

[originally from svn r5907]

18 years agoUnique solubility in Mines means that you can massively increase the
Simon Tatham [Fri, 3 Jun 2005 12:10:32 +0000 (12:10 +0000)]
Unique solubility in Mines means that you can massively increase the
mine density without (as you would with a conventional random grid
generator) rendering the game completely unplayable. High mine
densities are really good fun, and the point of the presets menu is
to provide people with pre-tested good settings and things they
might not have thought to try for themselves; so here are three
additional presets with high densities.

[originally from svn r5906]

18 years agoStandalone compilation mode which turns mines.c into a little
Simon Tatham [Thu, 2 Jun 2005 16:34:37 +0000 (16:34 +0000)]
Standalone compilation mode which turns mines.c into a little
utility to convert descriptive game IDs containing mine bitmaps
between obfuscated and cleartext. Might be handy for anyone planning
to design custom levels to send to friends (mines spelling out
`Happy Birthday', that sort of thing), as someone suggested to me
today :-)

[originally from svn r5903]

18 years agoFix various departures from C found by `gcc -ansi -pedantic'. I
Simon Tatham [Thu, 2 Jun 2005 08:14:14 +0000 (08:14 +0000)]
Fix various departures from C found by `gcc -ansi -pedantic'. I
haven't checked in Makefile changes to enable this, but I'll at
least fix the specific problems it found when enabled as a one-off.

[originally from svn r5902]

18 years agomin()/max() macros conflict with ones defined by Windows (or at least MinGW)
Jacob Nevins [Wed, 1 Jun 2005 22:56:20 +0000 (22:56 +0000)]
min()/max() macros conflict with ones defined by Windows (or at least MinGW)
headers; but MIN()/MAX() conflict with glib. Let's keep the lower-case ones,
and assume that any provided by the system have the obvious semantics.

[originally from svn r5900]

18 years agoFix Richard's patch so that it's actually C :-/
Simon Tatham [Wed, 1 Jun 2005 18:57:28 +0000 (18:57 +0000)]
Fix Richard's patch so that it's actually C :-/

[originally from svn r5899]

18 years agoAnother highlighting patch from Richard Boulton: immediately flag
Simon Tatham [Wed, 1 Jun 2005 18:33:25 +0000 (18:33 +0000)]
Another highlighting patch from Richard Boulton: immediately flag
any actual clashes (duplicate numbers in a row, column or block) in
red. This is a non-privileged deduction: it doesn't compare against
a known solution or consult a solver. It simply indicates reasons
why (no superset of) the current grid would cause the completion
flash to go off.

[originally from svn r5898]

18 years agoMiscellaneous fixes from James Harvey's PalmOS porting work:
Simon Tatham [Wed, 1 Jun 2005 17:47:56 +0000 (17:47 +0000)]
Miscellaneous fixes from James Harvey's PalmOS porting work:
 - fixed numerous memory leaks (not Palm-specific)
 - corrected a couple of 32-bit-int assumptions (vital for Palm but
   generally a good thing anyway)
 - lifted a few function pointer types into explicit typedefs
   (neutral for me but convenient for the source-munging Perl
   scripts he uses to deal with Palm code segment rules)
 - lifted a few function-level static arrays into global static
   arrays (neutral for me but apparently works round a Palm tools
   bug)
 - a couple more presets in Rectangles (so that Palm, or any other
   slow platform which can't handle the larger sizes easily, can
   still have some variety available)
 - in Solo, arranged a means of sharing scratch space between calls
   to nsolve to prevent a lot of redundant malloc/frees (gives a 10%
   speed increase even on existing platforms)

[originally from svn r5897]

18 years agoArrange that random seeds are as harmonised as they can reasonably
Simon Tatham [Wed, 1 Jun 2005 12:46:27 +0000 (12:46 +0000)]
Arrange that random seeds are as harmonised as they can reasonably
be between interactive and batch use.

[originally from svn r5896]

18 years agoI've proved that a grid dimension of 2 is capable of irretrievably
Simon Tatham [Wed, 1 Jun 2005 12:42:30 +0000 (12:42 +0000)]
I've proved that a grid dimension of 2 is capable of irretrievably
hanging the grid generator and that there's no way to fix it.
Therefore, lower limit of 3 squares in each direction, which will
upset envelope-pushers everywhere but doesn't destroy any actually
interesting puzzles.

[originally from svn r5895]

18 years agoGareth points out that the recess highlights around the outside of
Simon Tatham [Wed, 1 Jun 2005 07:22:21 +0000 (07:22 +0000)]
Gareth points out that the recess highlights around the outside of
the grid, in all games that have them, are drawn incorrectly when
the grid is not square. Fixed.

[originally from svn r5893]

18 years agoPatches from Richard B for Solo:
Simon Tatham [Wed, 1 Jun 2005 07:01:32 +0000 (07:01 +0000)]
Patches from Richard B for Solo:
 - prevent highlighting a clue square at all
 - enable easier switching between highlight types by not requiring
   a left-click highlight to be left-click-cancelled before
   right-clicking, and vice versa
 - fix bit-rot in -DSTANDALONE_SOLVER
Also one of mine:
 - replicate Richard's -DSTANDALONE_SOLVER fix in Pattern, where it
   was also broken.

[originally from svn r5892]

18 years agoChris Emerson observed the same status-bar flicker under GTK as I
Simon Tatham [Wed, 1 Jun 2005 06:54:14 +0000 (06:54 +0000)]
Chris Emerson observed the same status-bar flicker under GTK as I
did under Windows, so here's his patch (blatantly copied from my own
fix in windows.c :-).

[originally from svn r5891]

18 years agoTypo in click bounds checking.
Simon Tatham [Wed, 1 Jun 2005 06:47:55 +0000 (06:47 +0000)]
Typo in click bounds checking.

[originally from svn r5890]

18 years agoBetter mouse button handling in Mines:
Simon Tatham [Tue, 31 May 2005 18:38:01 +0000 (18:38 +0000)]
Better mouse button handling in Mines:
 - middle button now also triggers the clear-around-square action
 - a special-case handler in midend_process_key() arranges that the
   left button always trumps the right button if both are pressed
   together, meaning that Windows Minesweeper players used to
   pressing L+R to clear around a square should still be able to do
   so without any strange behaviour.
(The latter touches all game backends, yet again, to add a field to
the game structure which is zero in everything except Mines.)

[originally from svn r5888]

18 years agoBah, and remove the TODO item. As usual.
Simon Tatham [Tue, 31 May 2005 18:25:06 +0000 (18:25 +0000)]
Bah, and remove the TODO item. As usual.

[originally from svn r5887]

18 years agoNow _this_ is what Undo ought to be doing in a Minesweeper clone.
Simon Tatham [Tue, 31 May 2005 18:24:39 +0000 (18:24 +0000)]
Now _this_ is what Undo ought to be doing in a Minesweeper clone.
Rather than revealing the entire mine layout when you die, we now
only reveal the one mine that killed you. You can then Undo and
continue playing, without having spoiled the rest of the grid for
yourself. The number of times you've died is counted in the status
line (and is not reduced by Undo :-).

Amusingly, I think this in itself is quite a good way of dealing
with ambiguous sections in a Minesweeper grid: they no longer
_completely_ spoil your enjoyment of the game, because you can still
play the remainder of the grid even if you haven't got a completely
clean sweep. Just my luck that I should invent the idea when I've
already arranged for ambiguous sections to be absent :-)

[originally from svn r5886]

18 years agoAha! It turns out, after a bit of failure-mode profiling, that when
Simon Tatham [Tue, 31 May 2005 18:09:28 +0000 (18:09 +0000)]
Aha! It turns out, after a bit of failure-mode profiling, that when
the Mines unique grid generator fails at high mine densities it is
_almost always_ for the same reason, and it also turns out that this
reason is one which can be addressed. So here's an enhancement to
mineperturb() which enables Mines to generate a grid at (as far as I
can tell) any mine density you like, up to and including w*h-9
mines. At densities of 1 in 2 or thereabouts the grids start to look
rather strange, but it can at least generate them without hanging.

[originally from svn r5885]

18 years agovalgrind spotted this array underrun. I wonder if this might have
Simon Tatham [Tue, 31 May 2005 17:46:22 +0000 (17:46 +0000)]
valgrind spotted this array underrun. I wonder if this might have
been causing some of Verity's nonreproducible weirdnesses.

[originally from svn r5884]

18 years agoOops! A trivial typo in obfuscate_bitmap() made the obfuscation
Simon Tatham [Tue, 31 May 2005 17:09:39 +0000 (17:09 +0000)]
Oops! A trivial typo in obfuscate_bitmap() made the obfuscation
function rather less uniform-looking than I'd intended. I _thought_
it looked a bit fishy, but had assumed it was just the human
tendency to see patterns where none exist. Now fixed, and some real
test vectors confirm that this time the obfuscation function is
actually what I intended it to be.

This means that all masked game IDs generated before this revision
are now invalid. That's a shame, but the game is only a day old and
I think I can reasonably justify it as teething trouble.

[originally from svn r5883]

18 years ago`Solve' operation is relatively simple in Mines.
Simon Tatham [Tue, 31 May 2005 13:02:26 +0000 (13:02 +0000)]
`Solve' operation is relatively simple in Mines.

[originally from svn r5882]

18 years agoApparently a number of Windows programs like to use ^Y as a keyboard
Simon Tatham [Tue, 31 May 2005 12:41:18 +0000 (12:41 +0000)]
Apparently a number of Windows programs like to use ^Y as a keyboard
shortcut for Redo. I wasn't doing anything else with it, so why not?

[originally from svn r5880]

18 years agoDocument the mouse control method for Cube.
Jacob Nevins [Tue, 31 May 2005 12:12:47 +0000 (12:12 +0000)]
Document the mouse control method for Cube.

[originally from svn r5879]

18 years agoMove definition of PI into puzzles.h. If nothing else, the definition in cube.c
Jacob Nevins [Tue, 31 May 2005 12:03:25 +0000 (12:03 +0000)]
Move definition of PI into puzzles.h. If nothing else, the definition in cube.c
had a typo :)

[originally from svn r5878]

18 years agoMouse-based interface for Cube: you left-click anywhere on the grid
Simon Tatham [Tue, 31 May 2005 11:43:51 +0000 (11:43 +0000)]
Mouse-based interface for Cube: you left-click anywhere on the grid
and it moves the polyhedron in the general direction of the mouse
pointer. (I had this in my initial throwaway Python implementation
of this game, but never reimplemented it in this version. It's
harder with triangles, but not too much harder.)

Since the logical-to-physical coordinate mapping in Cube is
dynamically computed, this has involved an interface change which
touches all puzzles: make_move() is now passed a pointer to the
game_drawstate, which it may of course completely ignore if it
wishes.

[originally from svn r5877]

18 years agoEmma Garside suggested that it would be nice to have a different
Simon Tatham [Tue, 31 May 2005 11:20:24 +0000 (11:20 +0000)]
Emma Garside suggested that it would be nice to have a different
background colour for covered and uncovered squares in Mines, since
otherwise you have to distinguish them by the edge highlights alone.
So here one is; it's not _very_ different (it just looked odd if it
was any darker than this), but anyone who wants a bigger difference
can reconfigure it using the MINES_COLOUR_1 environment variable.

[originally from svn r5876]

18 years agoImproved the limited shuffle mechanism in Sixteen and Twiddle. They
Simon Tatham [Tue, 31 May 2005 11:19:11 +0000 (11:19 +0000)]
Improved the limited shuffle mechanism in Sixteen and Twiddle. They
were already making sure that no shuffle move was the precise
inverse of the previous one, or contributed to repeating the
previous one so many times as to turn it into effectively fewer
moves (doing the same rotation three times in Twiddle, or shifting a
row by more than half its length in Sixteen). However, they were
only checking against the _last_ move, which meant that in any
situation where there were completely disjoint move spaces (4x4n2
Twiddle, or any Sixteen at all) it was still possible to have A then
B then inv(A) occurring in the shuffle, leading to an unnecessarily
easy game.

Now both shuffle routines keep separate track of all
_non-overlapping_ recent moves, and will avoid inverting any move
which hasn't had another move overlap it since it was made. This
should reduce the incidence of too-easy limited shuffle games,
although it can't be prevented _entirely_ (since, if nothing else,
it's always possible to increase the shuffle limit past the maximum
group radius).

[originally from svn r5875]

18 years agoFix a couple of robustness issues.
Simon Tatham [Tue, 31 May 2005 08:56:33 +0000 (08:56 +0000)]
Fix a couple of robustness issues.

[originally from svn r5873]

18 years agoGTK misfires timers at inconvenient moments, sometimes causing a new
Simon Tatham [Tue, 31 May 2005 08:50:42 +0000 (08:50 +0000)]
GTK misfires timers at inconvenient moments, sometimes causing a new
puzzle of a different size to be redrawn before the pixmap is
resized, and since backends never redraw already-drawn stuff this is
a problem. Was biting me when I entered a Mines game ID of a
different size than the current settings into the Specific box.

[originally from svn r5872]

18 years agoChris's patch to stop Mines depending on char being signed.
Simon Tatham [Mon, 30 May 2005 22:33:34 +0000 (22:33 +0000)]
Chris's patch to stop Mines depending on char being signed.

[originally from svn r5871]

18 years agoAdded an `interactive' flag to new_game_desc(), which toggles Mines
Simon Tatham [Mon, 30 May 2005 18:41:40 +0000 (18:41 +0000)]
Added an `interactive' flag to new_game_desc(), which toggles Mines
between on the one hand generating indeterminate game descriptions
awaiting the initial click, and on the other hand generating
concrete ones which have had their initial click. This makes `mines
--generate' do something useful.

[originally from svn r5869]

18 years ago`Copy' operation for Mines.
Simon Tatham [Mon, 30 May 2005 18:24:06 +0000 (18:24 +0000)]
`Copy' operation for Mines.

[originally from svn r5868]

18 years agoConstrain mine count to be at most the largest number of mines we
Simon Tatham [Mon, 30 May 2005 17:57:45 +0000 (17:57 +0000)]
Constrain mine count to be at most the largest number of mines we
can guarantee to fit into the grid!

[originally from svn r5867]

18 years agoFirst cut at a game timer. Yet another backend function which
Simon Tatham [Mon, 30 May 2005 16:15:34 +0000 (16:15 +0000)]
First cut at a game timer. Yet another backend function which
indicates whether a particular game state should have the timer
going (for Mines the initial indeterminate state does not have this
property, and neither does a dead or won state); a midend function
that optionally (on request from the game) prepends a timer to the
front of the status bar text; some complicated midend timing code.

It's not great. It's ugly; it's probably slightly inaccurate; it's
got no provision for anyone but the game author decreeing whether a
game is timed or not. But Mines can't be taken seriously without a
timer, so it's a start.

[originally from svn r5866]

18 years agoD'oh, there's always one. Remove first-click stuff from the todo list.
Simon Tatham [Mon, 30 May 2005 13:11:05 +0000 (13:11 +0000)]
D'oh, there's always one. Remove first-click stuff from the todo list.

[originally from svn r5863]

18 years agoMines now follows the conventional approach of offering a completely
Simon Tatham [Mon, 30 May 2005 13:10:37 +0000 (13:10 +0000)]
Mines now follows the conventional approach of offering a completely
blank grid until you make the first click; to ensure solubility, it
does not generate the mine layout until that click, and then ensures
it is solvable starting from that position.

This has involved three infrastructure changes:

 - random.c now offers functions to encode and decode an entire
   random_state as a string
 - each puzzle's new_game() is now passed a pointer to the midend
   itself, which most of them ignore
 - there's a function in the midend which a game can call back to
   _rewrite_ its current game description.

So Mines now has two entirely separate forms of game ID. One
contains the generation-time parameters (n and unique) plus an
encoding of a random_state; the other actually encodes the grid once
it's been generated, and also contains the initial click position.
When called with the latter, new_game() does plausibly normal stuff.
When called with the former, it notes down all the details and waits
until the first square is opened, and _then_ does the grid
generation and updates the game description in the midend. So if,
_after_ your first click, you decide you want to share this
particular puzzle with someone else, you can do that fine.

Also in this checkin, the mine layout is no longer _copied_ between
all the game_states on the undo chain. Instead, it's in a separate
structure and all game_states share a pointer to it - and the
structure is reference-counted to ensure deallocation.

[originally from svn r5862]

18 years agoNeat idea from Gareth: if you put a % on the end of the mine count
Simon Tatham [Mon, 30 May 2005 12:24:31 +0000 (12:24 +0000)]
Neat idea from Gareth: if you put a % on the end of the mine count
in the Custom dialog box, it'll treat it as a mine density.

[originally from svn r5861]

18 years agoNit: "warning: extra tokens at end of #endif directive"
Jacob Nevins [Mon, 30 May 2005 11:49:08 +0000 (11:49 +0000)]
Nit: "warning: extra tokens at end of #endif directive"

[originally from svn r5860]

18 years agoInitial checkin of my Minesweeper clone, which uses a solver during
Simon Tatham [Mon, 30 May 2005 10:08:27 +0000 (10:08 +0000)]
Initial checkin of my Minesweeper clone, which uses a solver during
grid generation to arrange a mine layout that never requires guessing.

[originally from svn r5859]

18 years agoInfrastructure change: game_anim_length and game_flash_length now
Simon Tatham [Mon, 30 May 2005 07:55:27 +0000 (07:55 +0000)]
Infrastructure change: game_anim_length and game_flash_length now
both get passed a pointer to the game_ui. This means that if they
need to note down information for the redraw function about what
_type_ of flash or animation is required, they now have somewhere to
do so.

[originally from svn r5858]

19 years agoAdd a limited-shuffle mode like that added to Sixteen and Twiddle in r5769,
Jacob Nevins [Sat, 28 May 2005 23:45:43 +0000 (23:45 +0000)]
Add a limited-shuffle mode like that added to Sixteen and Twiddle in r5769,
for completeness.

[originally from svn r5854]
[r5769 == 8f1c713735316422cfe041400ccc49999d563d8b]

19 years agoAdd the ability to use the Rectangles solver for actually solving
Simon Tatham [Sat, 28 May 2005 08:04:29 +0000 (08:04 +0000)]
Add the ability to use the Rectangles solver for actually solving
puzzles, rather than just doing its nondeterministic number
placement thing. This enables the use of the `Solve' menu option on
externally entered game IDs, provided of course that they aren't
_too_ difficult.

[originally from svn r5852]

19 years agoAdd support for Jacob's new cursor-key modifier flags in the OS X frontend.
Simon Tatham [Thu, 26 May 2005 17:12:04 +0000 (17:12 +0000)]
Add support for Jacob's new cursor-key modifier flags in the OS X frontend.

[originally from svn r5847]

19 years agoSorted out the barriers/corners trouble left by r5844. No wonder
Simon Tatham [Thu, 26 May 2005 17:03:51 +0000 (17:03 +0000)]
Sorted out the barriers/corners trouble left by r5844. No wonder
Jacob wasn't able to find a satisfactory fix: the whole area was a
horrid mess. Fortunately, the reason it was a horrid mess was
because the Net drawing routines predated the introduction of clip()
in the frontend interface, and it turns out that clip() makes it
possible to do all this more easily and better. So, a complete
rearchitecting of barrier corners: the corner flags in the
`barriers' array are now gone (and good riddance), and corner
information is computed on the fly so as to take into account the
moving grid edges. In the process I've also updated the corner
mechanism so that a barrier `corner' (really endpoint) is drawn at
the end of _every_ barrier, not just where two meet. This has
changed the appearance of a single isolated barrier, to what I would
have wanted it to look like in the first place but achieving it
without clip() was just too fiddly.

[originally from svn r5846]
[r5844 == 865e8ad6ca3d83ad2a585ceeb1809e9f68c18a20]

19 years agoSince the split into random and descriptive IDs, the section on game seeds has
Jacob Nevins [Thu, 26 May 2005 16:57:19 +0000 (16:57 +0000)]
Since the split into random and descriptive IDs, the section on game seeds has
been mostly covered by the main documentation or otherwise moot.

[originally from svn r5845]

19 years agoAdd origin-shifting (Shift+cursors) and source-shifting (Ctrl+cursors) to Net.
Jacob Nevins [Thu, 26 May 2005 13:40:38 +0000 (13:40 +0000)]
Add origin-shifting (Shift+cursors) and source-shifting (Ctrl+cursors) to Net.
(Adding modifier+cursors handling has had minor knock-on effects on the other
puzzles, so that they can continue to ignore modifiers.)

(An unfortunate side effect of this is some artifacts in exterior barrier
drawing; notably, a disconnected corner can now appear at the corner of the
grid under some circumstances. I haven't found a satisfactory way round
this yet.)

[originally from svn r5844]

19 years agoSupport for `pencil marks' in Solo, by right-clicking and typing a
Simon Tatham [Wed, 25 May 2005 11:09:43 +0000 (11:09 +0000)]
Support for `pencil marks' in Solo, by right-clicking and typing a
number. Many thanks to Chris Thomas, for helping with the detailed
UI design by means of testing an endless series of prototypes.

[originally from svn r5842]

19 years agoMention NetWalk and update comment
Jacob Nevins [Tue, 24 May 2005 20:28:38 +0000 (20:28 +0000)]
Mention NetWalk and update comment

[originally from svn r5841]

19 years agoAvoid leading zeroes on internally generated random seeds, _just_ in
Simon Tatham [Mon, 23 May 2005 12:02:37 +0000 (12:02 +0000)]
Avoid leading zeroes on internally generated random seeds, _just_ in
case they confuse anyone who expects the same seed without the
leading zero to be equivalent.

[originally from svn r5838]

19 years agoI'm sick of `--generate' giving the same answers if you run it twice
Simon Tatham [Mon, 23 May 2005 11:15:39 +0000 (11:15 +0000)]
I'm sick of `--generate' giving the same answers if you run it twice
in one second. Switched the Unix get_random_seed() to using
gettimeofday() rather than time().

[originally from svn r5837]

19 years agoThe GTK `--generate' option didn't validate the game parameters. It
Simon Tatham [Mon, 23 May 2005 11:13:39 +0000 (11:13 +0000)]
The GTK `--generate' option didn't validate the game parameters. It
does now.

[originally from svn r5836]

19 years agoNet hangs if you ask it for a 2xn or nx2 wrapping puzzle with a
Simon Tatham [Mon, 23 May 2005 11:03:52 +0000 (11:03 +0000)]
Net hangs if you ask it for a 2xn or nx2 wrapping puzzle with a
unique solution. This, it turns out, is because there is literally
no such thing. Protective constraint added to validate_params(),
with a proof in a comment alongside.

If you really want a 2xn or nx2 wrapping puzzle, you can still have
one if you turn uniqueness off.

[originally from svn r5835]

19 years agoAesthetic improvements, mostly suggested by Gareth.
Simon Tatham [Sun, 22 May 2005 13:35:13 +0000 (13:35 +0000)]
Aesthetic improvements, mostly suggested by Gareth.

[originally from svn r5833]

19 years agoForgot to add print.py to the source archive. Ahem.
Simon Tatham [Sun, 22 May 2005 12:45:39 +0000 (12:45 +0000)]
Forgot to add print.py to the source archive. Ahem.

[originally from svn r5830]

19 years agoAnother tweak to the solver to make it handle blank tiles correctly.
Simon Tatham [Sun, 22 May 2005 12:14:39 +0000 (12:14 +0000)]
Another tweak to the solver to make it handle blank tiles correctly.
The previous checkin stopped it choking on them, but it didn't
actually manage to _deduce_ that all the edges bordering them had to
be closed. Now it does better.

[originally from svn r5829]

19 years agoSpecial case in dead-end checking which prevents the solver falling
Simon Tatham [Sun, 22 May 2005 11:45:20 +0000 (11:45 +0000)]
Special case in dead-end checking which prevents the solver falling
over on a grid containing a 0 (completely blank) tile. This can't
happen in self-generated grids, but can happen if you type in a grid
from another Net implementation. Previously, the solver would notice
(technically correctly!) that a completely blank tile connects to no
other tiles and thus forms an isolated subgraph, and would therefore
complain that no orientation of that tile could possibly yield a
valid solution...

[originally from svn r5828]

19 years agoThe Net solver now makes use of barrier information when applied to
Simon Tatham [Sun, 22 May 2005 11:15:03 +0000 (11:15 +0000)]
The Net solver now makes use of barrier information when applied to
a typed-in grid.

[originally from svn r5827]

19 years agoIt occurred to me yesterday that Net could perfectly well be played
Simon Tatham [Sun, 22 May 2005 11:06:25 +0000 (11:06 +0000)]
It occurred to me yesterday that Net could perfectly well be played
on paper, so here's a routine to print it out.

[originally from svn r5826]

19 years agoEnsure that an old random seed isn't left around for the user to see when a
Jacob Nevins [Sat, 21 May 2005 22:07:48 +0000 (22:07 +0000)]
Ensure that an old random seed isn't left around for the user to see when a
descriptive ID has been specified.
Fix tiny memory leak.

[originally from svn r5825]

19 years agoCleanups:
Simon Tatham [Sat, 21 May 2005 13:39:23 +0000 (13:39 +0000)]
Cleanups:
 - fix documentation of Net's unique solution option (should have
   tested before last checkin)
 - make unique solutions optional in Rectangles too (same reasons)
 - tidy up various issues in parameter encoding in both games.

[originally from svn r5818]

19 years agoSolution uniqueness for Net. Can be disabled on request (but is
Simon Tatham [Sat, 21 May 2005 13:23:26 +0000 (13:23 +0000)]
Solution uniqueness for Net. Can be disabled on request (but is
enabled by default), since ambiguous sections in grids can present
additional interesting challenges. I think uniqueness is a better
default, though.

[originally from svn r5816]

19 years agoMove IDM_ABOUT so that it doesn't overlap the presets space! Ahem.
Simon Tatham [Fri, 20 May 2005 12:30:37 +0000 (12:30 +0000)]
Move IDM_ABOUT so that it doesn't overlap the presets space! Ahem.

[originally from svn r5814]

19 years agoCunning way to ensure unique solutions in generated Rectangles
Simon Tatham [Thu, 19 May 2005 16:17:03 +0000 (16:17 +0000)]
Cunning way to ensure unique solutions in generated Rectangles
puzzles. I generate the grid of rectangles as normal, but before I
place the numbers I run it through a non-deterministic solver
algorithm which tries to do as much as it can with as little
information about where the numbers are going to be. The solver
itself narrows down the number placement when it runs out of steam,
but does so as little as possible. Once it reaches a state where it
has ensured solubility, and then the generation algorithm chooses
random number placement from whatever's left.

Occasionally it paints itself into a corner and can't ensure a
unique solution no matter what happens; in that situation we just
have to give up, generate a fresh grid, and try again.

[originally from svn r5809]

19 years agoIf you paste in a random seed with different ephemeral parameters
Simon Tatham [Wed, 18 May 2005 17:41:53 +0000 (17:41 +0000)]
If you paste in a random seed with different ephemeral parameters
from the currently configured ones, and then bring the Random Seed
box back up, the wrong parameters get shown, and the resulting
random seed is incorrect for the current game.

At least, it was, until this checkin.

[originally from svn r5808]

19 years agoRectangles random seed IDs shouldn't bother stating the expansion
Simon Tatham [Wed, 18 May 2005 17:28:48 +0000 (17:28 +0000)]
Rectangles random seed IDs shouldn't bother stating the expansion
factor if it's zero.

[originally from svn r5807]

19 years ago--version.
Simon Tatham [Wed, 18 May 2005 17:27:16 +0000 (17:27 +0000)]
--version.

[originally from svn r5806]

19 years agoIt's a good idea to validate presets received from the environment.
Simon Tatham [Wed, 18 May 2005 17:25:30 +0000 (17:25 +0000)]
It's a good idea to validate presets received from the environment.

[originally from svn r5805]

19 years agoMove the colour configuration into midend.c so that it becomes
Simon Tatham [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.

[originally from svn r5801]

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

[originally from svn r5800]

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

[originally from svn r5799]