70 Commits

Author SHA1 Message Date
23ab000b7b Cleanup: rename random_init() to random_new(), because it actually
_allocates_ a random_state rather than just initialising one passed
in by the caller.

[originally from svn r6412]
2005-10-22 16:27:54 +00:00
8a8474a311 Use game_set_size() to set up the temporary drawstate in
game_print(), wherever feasible. This fixes a specific bug in Loopy
(James H's new field ds->linewidth wasn't being set up, leading to
corrupted print output), but I've made the change in all affected
files because it also seems like a generally good idea to encourage
it for future games, to prevent other problems of this type.

There is one slight snag, which is that Map _can't_ do this because
its game_set_size() also initialises a blitter. I could fix this by
abstracting the common parts of Map's game_set_size() out into a
subfunction called by game_set_size() and also called directly by
game_print(); alternatively, I could introduce a means of
determining whether a `drawing *' was for screen or printing use.
Not sure which yet.

[originally from svn r6340]
2005-09-23 12:50:51 +00:00
7096df54de Various patches from Ben H: a fix for an outdated comment, a couple
of spurious ps_printf() arguments removed, and an error check in the
`make install' target.

[originally from svn r6275]
2005-09-05 17:21:05 +00:00
56ff3647e2 I've dithered a bit in the past about whether or not it's allowable
to call game_set_size() twice on the same drawstate. Finally, a
definite decision: it isn't. Accordingly, midend.c arranges never to
do so, the devel docs state that puzzles may enforce by assertion
that it never happens, and the four puzzles which care (i.e. use
blitters) do so.

[originally from svn r6274]
2005-09-05 17:18:03 +00:00
41b9855da9 Patches from James H. The usual stuff (memory leak fixes and 16-bit
cleanliness), plus he's enlarged the pencil-mark circles from
TILESIZE/8 to TILESIZE/7. Makes no difference at all (thanks to
integer division) when TILESIZE is the default of 20, but presumably
helps at some other tile sizes. Fine by me.

[originally from svn r6265]
2005-09-03 18:32:58 +00:00
94b36c11e0 James H has implemented a new `Tricky' difficulty level in Light Up:
a non-recursive level above Easy, which therefore moves the
recursive Hard mode further up still. Play-testing suggests that in
fact Tricky is often _harder_ than the old Hard mode, since the
latter had limited depth of recursion and would therefore spot
complex deductions only if it happened to start a recursion on the
right square; Tricky may be limited in the sophistication of its
complex deductions, but it never misses one, so its puzzles tend to
be hard all over.

Also in this checkin, a new source file `nullfe.c', containing all
the annoying stub functions required to make command-line solvers
link successfully. James wrote this for (the new) lightupsolver, and
I've used it to simplify the other stand-alone solvers.

[originally from svn r6254]
2005-09-01 11:57:56 +00:00
6992530a85 Ability to drag pencil marks around.
[originally from svn r6250]
2005-08-31 19:27:41 +00:00
c70312f8a8 Terribly cunning approach to making the pencil marks look nicer,
thanks to Gareth.

[originally from svn r6248]
2005-08-31 17:34:47 +00:00
068a092cd5 Ahem; forgot about recursion. Recursive solving now shows its
working as well.

[originally from svn r6245]
2005-08-31 12:43:14 +00:00
f2ff444fca Now that Map has some seriously complex deductions, it's about time
it had a command-line solver. In order to do this, I've had to
expose the internal region numbering because the solver has to have
some way to state which region it means; and in any case it's also
useful to have human-visible region numbering so that two people can
discuss a puzzle they're solving together. So pressing L during play
now toggles the display of region numbers; and `mapsolver' uses
those same numbers when showing its working and its solutions.

[originally from svn r6244]
2005-08-31 12:17:01 +00:00
121f664b62 Forcing chains in Map give rise to a new `Hard' difficulty level.
Also implemented the Map analogue of Solo's pencil marks, to make
this mode more playable.

[originally from svn r6240]
2005-08-30 19:42:45 +00:00
4d6c8c7337 Typo in comment :-)
[originally from svn r6236]
2005-08-29 09:14:35 +00:00
ea9142fbda Ahem. The region density at which things start to get hairy is 2/3
of the grid area, not 3/2!

[originally from svn r6235]
2005-08-29 09:05:35 +00:00
2c85fd3530 Aesthetic improvements to the Map error indicators:
- the exclamation mark was a bit dot-heavy
 - allowing the indicator to be placed at a grid point as well as
   half way between two grid points allows some much more natural
   positioning.

[originally from svn r6234]
2005-08-29 08:57:45 +00:00
2975ae2811 Unreasonable mode for Map.
[originally from svn r6229]
2005-08-28 14:29:19 +00:00
e483fc513b Error highlighting in Map.
[originally from svn r6228]
2005-08-28 13:53:07 +00:00
b0614e6da8 `Solve' operation on an already solved map without an aux_info was
returning NULL due to no moves being required, leading to a strange
error message. Trivial fix.

[originally from svn r6198]
2005-08-22 09:27:52 +00:00
af59dcf685 Substantial infrastructure upheaval. I've separated the drawing API
as seen by the back ends from the one implemented by the front end,
and shoved a piece of middleware (drawing.c) in between to permit
interchange of multiple kinds of the latter. I've also added a
number of functions to the drawing API to permit printing as well as
on-screen drawing, and retired print.py in favour of integrated
printing done by means of that API.

The immediate visible change is that print.py is dead, and each
puzzle now does its own printing: where you would previously have
typed `print.py solo 2x3', you now type `solo --print 2x3' and it
should work in much the same way.

Advantages of the new mechanism available right now:
 - Map is now printable, because the new print function can make use
   of the output from the existing game ID decoder rather than me
   having to replicate all those fiddly algorithms in Python.
 - the new print functions can cope with non-initial game states,
   which means each puzzle supporting --print also supports
   --with-solutions.
 - there's also a --scale option permitting users to adjust the size
   of the printed puzzles.

Advantages which will be available at some point:
 - the new API should permit me to implement native printing
   mechanisms on Windows and OS X.

[originally from svn r6190]
2005-08-18 17:50:14 +00:00
cceee3cac9 Memory leak fixes from James H.
[originally from svn r6188]
2005-08-13 21:35:41 +00:00
6ada3841a1 New puzzle: `Map'. Vaguely original, for a change.
(This puzzle is theoretically printable, but I haven't added it in
print.py since there's rather a lot of painful processing required
to get from the game ID to the puzzle's visual appearance. It
probably won't become printable unless I get round to implementing a
more integrated printing architecture.)

[originally from svn r6186]
2005-08-13 10:43:26 +00:00