6 Commits

Author SHA1 Message Date
0564c4c4d0 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]
2005-05-30 13:10:37 +00:00
6b9e690c89 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]
2005-05-30 10:08:27 +00:00
aa9a8e8c7e The Windows RNG turns out to only give about 16 bits at a time. This
is (a) pretty feeble, and (b) means that although Net seeds transfer
between platforms and still generate the same game, there's a
suspicious discrepancy in the typical seed _generated_ by each
platform.
I have a better RNG kicking around in this code base already, so
I'll just use it. Each midend has its own random_state, which it
passes to new_game_seed() as required. A handy consequence of this
is that initial seed data is now passed to midend_new(), which means
that new platform implementors are unlikely to forget to seed the
RNG because failure to do so causes a compile error!

[originally from svn r4187]
2004-05-03 09:10:52 +00:00
3b1ec74d73 Fix zillions of MSVC compiler warnings. Sigh.
[originally from svn r4165]
2004-04-28 17:37:13 +00:00
9867234e70 Further general development. Net is now playable, though
configuration is absent as yet.

[originally from svn r4145]
2004-04-26 17:10:44 +00:00
96dbb537ee Initial checkin of a portable framework for writing small GUI puzzle
games.

[originally from svn r4138]
2004-04-25 14:27:58 +00:00