aboutsummaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAge
...
* Unify the two solvers in Solo. nsolve has now had recursionSimon Tatham2005-07-06
| | | | | | | | | | | | | | | | | | | | | | | | | | capability added to it, to be used only when all else fails, and is simply called `solver'. This means that: - solving of 5x5 Trivial grids using the `Solve' function, which previously hung for ages because rsolve happened to take a wrong turning at the start, is now zippy - solosolver doesn't require the confusing -r and -n options - solosolver can show its working even for Unreasonable grids. Unfortunately, the new unified solver still isn't suitable for grid generation. After it proved to be so much faster at solving 5x5s, I hoped to be able to substitute it for rsolve during generation and gain additional speed in 5x5 generation too; but no luck, because it's slower _per recursion level_, and although during solving it makes up for this by needing very few levels, there is a lot of _unavoidable_ recursion during generation, especially at 5x5. A hybrid strategy which starts off with rsolve and switches to the unified solver at a critical point proved unsatisfactory as well, because the critical point changes depending on the vagaries of the recursion and can't be pinpointed easily. So rsolve is still in there, only renamed `gridgen' because that's now all it's good for. [originally from svn r6077]
* Refactoring from James H: the highlight and lowlight colour setupSimon Tatham2005-07-06
| | | | | | | common to Fifteen, Sixteen, Twiddle and Pegs is now a utility function in misc.c. [originally from svn r6076]
* Some patches from James H:Simon Tatham2005-07-06
| | | | | | | | | | | | | | - reinstate the initialisation of ds->w and ds->h in guess.c, which I'd accidentally removed during game_size() refactoring - reorganise Net's interpret_move() so that my uncommitted patch for drag-based UI (which he uses on the Palm port) will apply more easily - the interpret_move() changes make it easy to have a single move type which rotates a tile by 180 degrees, so this is now provided via the `F' key (but there's no spare button available to provide it via the mouse). [originally from svn r6070]
* Revert the code that assumed that incoming parameters used a random generationJacob Nevins2005-07-05
| | | | | | | | scheme in r6068, since this messed up the non-permanency of the non-limited parameter. [originally from svn r6069] [r6068 == f3c95109c7b905f74b5f149eea21f68444c31ef7]
* Add a `full' parameter to validate_params(), analogous to the one inJacob Nevins2005-07-05
| | | | | | | | | | | encode_params(). This is necessary for cases where generation-time parameters that are normally omitted from descriptive IDs can place restrictions on other parameters; in particular, when the default value of a relevant generation-time parameter is not the one used to generate the descriptive ID, validation could reject self-generated IDs (e.g., Net `5x2w:56182ae7c2', and some cases in `Pegs'). [originally from svn r6068]
* Enhancements to mkfiles.pl and Recipe to arrange for the auxiliarySimon Tatham2005-07-05
| | | | | | | | | | | command-line programs (solosolver, patternsolver, mineobfusc) to be built as part of the normal Makefiles. This means mkfiles.pl now has the capability to compile a source file more than once with different #defines. Also, fixes for those auxiliary programs and one fix in midend.c which the Borland compiler objected to while I was testing its makefile generation. [originally from svn r6066]
* It's been a new year for a while now.Jacob Nevins2005-07-05
| | | | [originally from svn r6065]
* revert supposed typo -- I have no brainJacob Nevins2005-07-05
| | | | [originally from svn r6064]
* Add HACKING to main doc build.Jacob Nevins2005-07-05
| | | | [originally from svn r6063]
* typoJacob Nevins2005-07-05
| | | | [originally from svn r6062]
* Add a completion flash when you get down to a single peg.Jacob Nevins2005-07-05
| | | | [originally from svn r6061]
* Refactored the game_size() interface, which was getting reallySimon Tatham2005-07-05
| | | | | | | | | | | | | unpleasant and requiring lots of special cases to be taken care of by every single game. The new interface exposes an integer `tile size' or `scale' parameter to the midend and provides two much simpler routines: one which computes the pixel window size given a game_params and a tile size, and one which is given a tile size and must set up a drawstate appropriately. All the rest of the complexity is handled in the midend, mostly by binary search, so grubby special cases only have to be dealt with once. [originally from svn r6059]
* James Harvey points out a missing ifdef.Simon Tatham2005-07-05
| | | | [originally from svn r6058]
* Clarify that diagonal moves are not permitted in Pegs.Jacob Nevins2005-07-04
| | | | [originally from svn r6057]
* Add WinHelp topic.Jacob Nevins2005-07-04
| | | | [originally from svn r6056]
* There's always one. Forgot to add Pegs to `make install'.Simon Tatham2005-07-04
| | | | [originally from svn r6054]
* Documentation for Pegs.Simon Tatham2005-07-04
| | | | [originally from svn r6053]
* Peg Solitaire implementation, complete with a random boardSimon Tatham2005-07-04
| | | | | | | generator. The generator is lacking in almost any kind of finesse, but it produces puzzles which at least _I_ find plausibly puzzling. [originally from svn r6052]
* Document keyboard controls for FlipJacob Nevins2005-07-04
| | | | [originally from svn r6051]
* Fix bounds checking for Flip cursor control.Jacob Nevins2005-07-04
| | | | [originally from svn r6050]
* James H's patch for a keyboard-controlled cursor in Flip.Simon Tatham2005-07-03
| | | | [originally from svn r6049]
* Allow game backends to use even special keystrokes such as N and Q;Simon Tatham2005-07-03
| | | | | | | | | | | | | they will only be processed as special by the midend if unwanted by the backend. This causes 5x5 Solo to become just about playable, because you can now click in a square and type `n'. However, typing `n' when a square is not selected will revert to the normal behaviour of starting a new game. (This isn't particularly ideal, I know, but it's better than nothing.) [originally from svn r6048]
* draw_polygon() and draw_circle() have always had a portabilitySimon Tatham2005-07-03
| | | | | | | | | | | | | | | | | | | constraint: because some front ends interpret `draw filled shape' to mean `including its boundary' while others interpret it to mean `not including its boundary' (and X seems to vacillate between the two opinions as it moves around the shape!), you MUST NOT draw a filled shape only. You can fill in one colour and outline in another, you can fill or outline in the same colour, or you can just outline, but just filling is a no-no. This leads to a _lot_ of double calls to these functions, so I've changed the interface. draw_circle() and draw_polygon() now each take two colour arguments, a fill colour (which can be -1 for none) and an outline colour (which must be valid). This should simplify code in the game back ends, while also reducing the possibility for coding error. [originally from svn r6047]
* James Harvey points out that entering an invalid game ID can affectSimon Tatham2005-07-01
| | | | | | | | | | the current midend state even if you don't subsequently enter a valid one. Reorganise midend_game_id_int() so that (just like midend_deserialise()) it does all its error checking before altering anything in the midend's persistent data, so that it either succeeds completely or fails before doing anything at all. [originally from svn r6045]
* Prevent drags from being started outside the playing area, which wasSimon Tatham2005-06-30
| | | | | | | | causing invalid move descriptions to be returned from interpret_move() and then failing an assertion when execute_move() refused them. [originally from svn r6044]
* Preset names retrieved from the environment must be dupstr()ed. HowSimon Tatham2005-06-30
| | | | | | | did I miss this before? It just caused a segfault for me, which is entirely fair enough, but I've no idea why it didn't fail before! [originally from svn r6043]
* Load and Save are now supported on all three desktop platforms, andSimon Tatham2005-06-30
| | | | | | | documented. (This means the GTK temporary dependency on an environment variable is now gone.) [originally from svn r6042]
* General robustness patch from James Harvey:Simon Tatham2005-06-30
| | | | | | | | | | | | | - most game_size() functions now work in doubles internally and round to nearest, meaning that they have less tendency to try to alter a size they returned happily from a previous call - couple of fiddly fixes (memory leaks, precautionary casts in printf argument lists) - midend_deserialise() now constructs an appropriate drawstate, which I can't think how I overlooked myself since I _thought_ I went through the entire midend structure field by field! [originally from svn r6041]
* Attempting to begin a drag from (i.e. just click on) the hint pegsSimon Tatham2005-06-30
| | | | | | | for a past guess caused strangeness up to and including segfault, thanks to bad bounds checking. Well spotted John Sullivan. [originally from svn r6040]
* Add a cast whose absence was causing a (-Werror-exacerbated) compileSimon Tatham2005-06-29
| | | | | | warning on OS X. [originally from svn r6037]
* Validation of random-state-type game descriptions was broken. ThisSimon Tatham2005-06-29
| | | | | | | meant that a Mines game saved before the first click had taken place could not be successfully reloaded. [originally from svn r6036]
* When serialising this game, it's probably better to keep theSimon Tatham2005-06-29
| | | | | | half-finished guess in the game_ui rather than throwing it away. [originally from svn r6033]
* Make peg removal accessible from the keyboard.Jacob Nevins2005-06-28
| | | | [originally from svn r6032]
* New {en,de}code_ui functions should be static. Oops.Simon Tatham2005-06-28
| | | | [originally from svn r6031]
* Actually implemented the serialise/deserialise functions inSimon Tatham2005-06-28
| | | | | | | | | | | | midend.c. Also I've added an experimental front end in gtk.c only: `Save' and `Load' options on the Game menu, which don't even show up unless you define the magic environment variable PUZZLES_EXPERIMENTAL_SAVE. Once I'm reasonably confident that the whole edifice is plausibly stable, I'll take that out and turn it into a supported feature (and also implement it in OS X and Windows and write documentation). [originally from svn r6030]
* More serialisation changes: the game_aux_info structure has now beenSimon Tatham2005-06-28
| | | | | | | | | | | | retired, and replaced with a simple string. Most of the games which use it simply encode the string in the same way that the Solve move will also be encoded, i.e. solve_game() simply returns dupstr(aux_info). Again, this is a better approach than writing separate game_aux_info serialise/deserialise functions because doing it this way is self-testing (the strings are created and parsed during the course of any Solve operation at all). [originally from svn r6029]
* Rogue diagnostic!Simon Tatham2005-06-28
| | | | [originally from svn r6028]
* Move a rogue declaration to the top of its block.Simon Tatham2005-06-28
| | | | [originally from svn r6027]
* Another function pair required for serialisation; these ones saveSimon Tatham2005-06-28
| | | | | | | | | | | and restore anything vitally important in the game_ui. Most of the game_ui is expected to be stuff about cursor positions and currently active mouse drags, so it absolutely _doesn't_ want to be preserved over a serialisation; but one or two things would be disorienting or outright wrong to reset, such as the Net origin position and the Mines death counter. [originally from svn r6026]
* Annoying special cases for Mines.Simon Tatham2005-06-28
| | | | | | | | | | | | | | | | Firstly, the `Restart' function now reconstructs an initial game state from the game description rather than dup_game(states[0]). This means that Restart in a game of Mines restarts to just _after_ the initial click, so you can resume the puzzle-solving part without having to remember where you placed that click. Secondly, the midend now contains a second `private' game desc, which is guaranteed to actually reconstruct the initial game_state correctly (which Mines's publicly visible game descs tend not to, since they describe a state which has already had the first click). This should make serialising of Mines more sensible. [originally from svn r6025]
* Re-architecting of the game backend interface. make_move() has beenSimon Tatham2005-06-27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | split into two functions. The first, interpret_move(), takes all the arguments that make_move() used to get and may have the usual side effects of modifying the game_ui, but instead of returning a modified game_state it instead returns a string description of the move to be made. This string description is then passed to a second function, execute_move(), together with an input game_state, which is responsible for actually producing the new state. (solve_game() also returns a string to be passed to execute_move().) The point of this is to work towards being able to serialise the whole of a game midend into a byte stream such as a disk file, which will eventually support save and load functions in the desktop puzzles, as well as restoring half-finished games after a quit and restart in James Harvey's Palm port. Making each game supply a convert-to-string function for its game_state format would have been an unreliable way to do this, since those functions would not have been used in normal play, so they'd only have been tested when you actually tried to save and load - a recipe for latent bugs if ever I heard one. This way, you won't even be able to _make_ a move if execute_move() doesn't work properly, which means that if you can play a game at all I can have pretty high confidence that serialising it will work first time. This is only the groundwork; there will be more checkins to come on this theme. But the major upheaval should now be done, and as far as I can tell everything's still working normally. [originally from svn r6024]
* Fix GTK casts to restore correct compilation on GTK 2.0 after r6022.Simon Tatham2005-06-26
| | | | | [originally from svn r6023] [r6022 == e1c84c9a4ea9e74c128c28a77ea08336350991e3]
* Under Gtk 1.2 (at least on Debian woody), a config or preset change that wouldJacob Nevins2005-06-26
| | | | | | | | otherwise not cause the window size to change caused it to become very small indeed. This change from Simon fixes that behaviour; I haven't tested it with Gtk 2. [originally from svn r6022]
* Add debugging support.Jacob Nevins2005-06-25
| | | | [originally from svn r6018]
* Further additions to the Guess docs.Jacob Nevins2005-06-25
| | | | [originally from svn r6014]
* Make the keyboard-control cursors visible whenever a keyboard control isJacob Nevins2005-06-25
| | | | | | activated. [originally from svn r6013]
* The AngleArc() function that was being used to draw circles on Windows turnsJacob Nevins2005-06-25
| | | | | | | out to be unsupported on the Win9x/Me series. Use Arc() instead (tested on Win98 and Win2K). [originally from svn r6012]
* Couple of presets.Simon Tatham2005-06-24
| | | | [originally from svn r6011]
* More patches from James Harvey: enforce a maximum brightness in theSimon Tatham2005-06-24
| | | | | | | | | background colour (to ensure white pegs show up against it), and convert the keyboard-control cursor into a rectangle when it's over the hint pegs (otherwise it looks rather silly for numbers of pegs above 4). [originally from svn r6010]
* Fix another display/UI glitch which triggered if you filled a rowSimon Tatham2005-06-24
| | | | | | | | (so that the hint pegs lit up as `ready') and then pressed Undo: the markable flag would remain set and the redrawing wouldn't darken the pegs again. [originally from svn r6009]