163d62b07fMike points out that I made an error in one of the presets...
Simon Tatham
2005-08-25 07:57:58 +00:00
c564df0828Over-enthusiastic assertion introduced in the printing revamp was causing Mines to crash one second after starting a game. Oops.
Simon Tatham
2005-08-24 22:13:43 +00:00
5dc47a7ba1Optimiser placation for OS X gcc.
Simon Tatham
2005-08-24 21:44:54 +00:00
c9b47daf1bNew puzzle: Loopy', an implementation of Nikoli's Slither Link' or `Loop the Loop' puzzle. Contributed by Mike Pinna.
Simon Tatham
2005-08-24 21:32:54 +00:00
c6fa81bfc0Minor update to Solo's documentation due to Extreme mode.
Simon Tatham
2005-08-24 17:49:52 +00:00
99f8178aabBrand new difficulty level in Solo. The other day Gareth and I independently discovered an advanced reasoning technique in Map, and then it occurred to me that since Solo can also be considered as a graph-colouring game the same technique ought to be applicable. And it is; so here's a new difficulty level, Extreme', which sits just above Advanced. Grids graded Extreme' by new-Solo will of course fall into old-Solo's `Unreasonable' category (since they're not soluble using the old set of non-recursive methods). A brief and unscientific experiment suggests that about one in six Unreasonable grids generated by old-Solo are classified Extreme by the new solver; so the remaining Unreasonable mode (now containing a subset of the grids it used to) hasn't actually become much harder.
Simon Tatham
2005-08-24 17:32:39 +00:00
d558bb240aDon't report an error when loading a saved game from the command line unless there really _is_ an error!
Simon Tatham
2005-08-23 12:49:21 +00:00
196695afdfJames H points out a rogue fprintf in Net's print routine.
Simon Tatham
2005-08-22 22:58:19 +00:00
fb6e7f1a8bMemory leak in the new printing stuff, plus a couple of comment corrections.
Simon Tatham
2005-08-22 18:46:38 +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.
Simon Tatham
2005-08-22 09:27:52 +00:00
cd76bfb25f*blinks* I apparently didn't try _building_ the OS X port since the printing upheaval. I could have sworn I had. Oh well; small errors fixed.
Simon Tatham
2005-08-21 10:55:17 +00:00
c136c3dde9Retire redundant print_line_width() in Net: a relic from a failed printing strategy, irrelevant to the one which worked.
Simon Tatham
2005-08-20 15:49:43 +00:00
3bfb9b108eNative Windows printing support, using the infrastructure I put in place in r6190. I'm quite pleased that I didn't have to modify the printing infrastructure _at all_ to make this work; the only source change required outside windows.c was the addition of a trivial utility function midend_get_params(), and that was for the benefit of bulk puzzle generation rather than anything to do with actual printing.
Simon Tatham
2005-08-20 15:48:55 +00:00
cf224a6556Richard B points out a cut and paste error.
Simon Tatham
2005-08-19 12:29:08 +00:00
ca108a017bBah, there's always one. Remove the now-erroneous `*.py' from the makedist script.
Simon Tatham
2005-08-19 07:49:44 +00:00
af59dcf685Substantial 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.
Simon Tatham
2005-08-18 17:50:14 +00:00
ca6950b0f7Just noticed another thing that could easily catch me out when adding a new puzzle.
Simon Tatham
2005-08-15 14:12:07 +00:00
cceee3cac9Memory leak fixes from James H.
Simon Tatham
2005-08-13 21:35:41 +00:00
6ada3841a1New puzzle: `Map'. Vaguely original, for a change.
Simon Tatham
2005-08-13 10:43:26 +00:00
12def7ede216-bit-cleanness fixes from James H (again). It would be really nice to have some means of automatically spotting this sort of problem on a desktop platform, but I can't immediately think of one; building a trick compiler which thinks `int' is 16 bits would be the obvious option, but it would immediately break the ABIs to all the system functions.
Simon Tatham
2005-08-11 11:06:13 +00:00
8da47177f3Very fiddly corrections to the loop highlighting. ERRSLASH means the slash in this square is red, so it does indeed imply that some of the edge markings are also red; but it doesn't mean _all_ the edge markings must be red. So instead of assuming ERRSLASH implies all edge error markers, we set the correct set of edge error markers at the same time as setting ERRSLASH, at which point we know which kind of slash it is so we know which ones to set.
Simon Tatham
2005-08-09 18:09:07 +00:00
2bd8e241a9Implement error checking in Slant. Clue points are now highlighted in red if it's impossible to fulfill them (either through too many neighbours connecting to them, or too many not connecting to them), and edges are highlighted in red if they form part of a loop.
Simon Tatham
2005-08-09 17:14:25 +00:00
c8c576f689Remove conditional definition of MAX_GRIDGEN_TRIES, for consistency between Palm and other ports when fed the same random seed.
Simon Tatham
2005-08-07 08:47:08 +00:00
6c3916f77ePlacate optimiser.
Simon Tatham
2005-08-07 08:01:51 +00:00
a42b11add3Streamline `slantsolver' a bit (avoid showing advanced working on easy puzzles, and stop having a second encoding of the difficulty levels).
Simon Tatham
2005-08-06 14:52:26 +00:00
c3d1982dcbDocument hard mode in Slant, and also fix an obvious memory management error in game_configure().
Simon Tatham
2005-08-06 10:38:34 +00:00
98a9f06a67Introduce an environment variable setting (SLANT_SWAP_BUTTONS=yes) to reverse the effect of the mouse buttons. Gareth has been complaining about this for days: apparently he finds precisely the opposite control system intuitive to me.
Simon Tatham
2005-08-06 10:33:46 +00:00
8392232d57A bunch of new reasoning techniques in the Slant solver, leading to a new Hard mode. Also added a command-line `slantsolver' which can grade puzzles and show working.
Simon Tatham
2005-08-06 10:24:52 +00:00
c321a88408Cleanups to completion flashes: all four of these games used to redraw the whole window _every_ time game_redraw() was called during a flash. Now they only redraw the whole window every time the background colour actually changes. Thanks to James H for much of the work.
Simon Tatham
2005-08-05 17:17:23 +00:00
56e01e54faNew puzzle: `Light Up', by James H.
Simon Tatham
2005-08-04 19:14:10 +00:00
20b1a77244Environment-based configuration wasn't sensibly usable in games with spaces in the name. Fixed. (One day I really must get round to turning this into a proper config mechanism.)
Simon Tatham
2005-08-04 18:09:48 +00:00
dc74c8b93dPatch from James H: tinker with the presets on SLOW_SYSTEMs.
Simon Tatham
2005-08-04 17:08:26 +00:00
2e214d740cBug fix from James H: solve_game() was returning error messages in the return value rather than in *error. In the old days type- checking would have caught this, but now of course they're the same type.
Simon Tatham
2005-08-04 17:07:51 +00:00
e55838bc9bI am COMPLETELY GORMLESS. The Solo grid generator, when eliminating clues from a filled grid, was using the algorithm
Simon Tatham
2005-08-04 11:16:10 +00:00
414330d9adCleanups from James H: a few missing statics, a precautionary cast or two, a debugging fix, a couple of explicit initialisations of variables that were previously read uninitialised, and a fix for a whopping great big memory leak in Slant owing to me having completely forgotten to write free_game().
Simon Tatham
2005-08-03 12:44:51 +00:00
c212a1b5ebSlant uses the same generation strategy as Solo, despite not having the property which devel.but claimed to be the reason why that strategy works. A bit of thought revealed what the _real_ reason is why this strategy works in some puzzles and not others, so I've rewritten the paragraph to be more accurate.
Simon Tatham
2005-08-03 11:06:16 +00:00
afe80030e4New puzzle: `Slant', picked from the Japanese-language section of nikoli.co.jp (which has quite a few puzzles that they don't seem to have bothered to translate into English).
Simon Tatham
2005-08-02 23:16:46 +00:00
207c847553Various cleanups and clarifications to devel.but; some from Richard B and some from me. Also an additional utility function `random_copy' from Richard B, which he says is useful in a new puzzle he's working on and which seems likely to come in handy again at some point.
Simon Tatham
2005-08-01 11:27:01 +00:00
e6132341c4New end-game approach to Black Box. Instead of revealing the ball positions immediately when you make an error, the game now reveals as little information as is necessary to prove you wrong (including none - if an existing laser path you know about is inconsistent with your guesses, the game will just point it out and tell you nothing new!) and you can try again. Errors are counted in much the same way as deaths in Mines.
Simon Tatham
2005-07-31 14:56:18 +00:00
ef36a4232cmissing i' in \e'
Jacob Nevins
2005-07-29 23:05:10 +00:00
e37c2c0ad2One more fix from Ben H. Also switched round the arena colour selection in the redraw function, so that locked squares are no longer displayed once the game is at an end. (It looked untidy and disorienting for lighter-coloured locked squares to suddenly become darker when the box was opened. You can still flip back and forth to your previous game state using undo/redo if you want to compare the results against your lock pattern.)
Simon Tatham
2005-07-29 16:45:52 +00:00
14ad9d832eVarious fixes and cleanups suggested by Ben Hutchings: - clarified wording of messages in validate_params(), including in particular a correction from < 255' to <= 255' - fixed random_upto() in game generation which caused the maximum number of balls never to be used when there was uncertainty - fixed widespread miscalculation of rectangular-array indices (multiplication by h instead of w, which would have broken non-square grids rather profoundly) - corrected an ANSI namespace violation - removed real functionality from the inside of assert() statements, so that the game should still work when compiled -DNDEBUG - couple of unnecessary linear-time loops removed.
Simon Tatham
2005-07-29 12:07:10 +00:00
b0adb79178Ben Hutchings reports that gcc 4 gives an optimiser warning because it can't tell that one branch of a particular switch is always taken. Adding a default clause with an automatic assertion failure apparently fixes it.
Simon Tatham
2005-07-29 11:34:02 +00:00
178a86197bPatches from Ben Hutchings to fix failures of sscanf error checking.
Simon Tatham
2005-07-29 11:24:55 +00:00
19c9453b5cTweak a paragraph after discussion with Simon.
Jacob Nevins
2005-07-29 08:20:40 +00:00
f44e4acd4aShiny new developer documentation to replace the old sketchy HACKING guide.
Simon Tatham
2005-07-28 17:12:18 +00:00
cc06b70328The very core of cross() is capable of suffering integer overflow on large puzzles. Resort to hand-hacked 64-bit arithmetic for doing dot products; everything else remains in `long' for the moment.
Simon Tatham
2005-07-24 10:39:33 +00:00
3b5711c6a5Another diagnostic mode for Untangle: if compiled with `-DSHOW_CROSSINGS', it will show each edge in red if it is crossed by anything, and in black otherwise. Distracting and not particularly useful during play, but occasionally handy for debugging cross().
Simon Tatham
2005-07-24 10:09:04 +00:00
4da39de282(GTK only so far) Allow the argument passed to a game binary to be either a game ID or a save file name. (The former takes priority, because you can usually find a synonym for the latter, such as by prepending ./' or $PWD/'.)
Simon Tatham
2005-07-24 10:05:11 +00:00
0a798c7484Solve animation (currently only in Untangle) was failing to set me->anim_pos to zero, meaning that if it happened immediately after a completion flash then anim_pos would start off half way through its run.
Simon Tatham
2005-07-22 12:07:56 +00:00
bed038e17fThe Solve' operation now rotates and/or reflects the solution grid to bring it as close as possible to the current game state. This means that if you request Solve' after solving a puzzle yourself, with the intention of finding out how similar your solution is to the program's, then you will mostly see the differences in _shape_ rather than those being masked by the fact that yours happened to be the other way up.
Simon Tatham
2005-07-22 11:55:50 +00:00
a605a17d05James H profiled the new Same Game grid generator and discovered it was spending 60% of its time in shuffle(). The purpose of the shuffle() call was to go through a largish array in random order until we found an element that worked, so there's no actual need to shuffle the whole array every time and I only did it out of laziness. So I now pick a random element each time I go round the loop, meaning I save a lot of shuffling effort whenever the loop terminates early (which is often). I get about a factor of two speed improvement from this small change.
Simon Tatham
2005-07-22 11:06:57 +00:00
6bce285027Until now, Same Game has been the only puzzle in this collection which is unable to guarantee that every grid it generates can be solved. So I'm eliminating that exception: this checkin contains a more sophisticated grid generator which does guarantee solubility. It's a bit slow (most noticeably on the 15x10c3 preset), and the quality of the generated grids is slightly weird (a tendency toward small regions rather than large sweeping areas of contiguous colour); however, I'm willing to see the latter as a feature for now, since making the game more challenging while simultaneously guaranteeing it to be possible sounds like an all-round win to me.
Simon Tatham
2005-07-21 18:06:31 +00:00
d2d4b07e15I've been meaning to do this for ages: all the Makefiles now give $(XFLAGS) _after_ $(CFLAGS) on the compiler command lines, meaning that you can provide options in XFLAGS on the makefile which will override the ones in CFLAGS. For example, `make XFLAGS=-O0' to make debugging easier.
Simon Tatham
2005-07-21 17:26:46 +00:00
11ce8d7abdSync with website
Jacob Nevins
2005-07-20 23:35:43 +00:00
1ff15ba8adThe Untangle completion flash was weedy and anaemic; beef it up a bit. In particular, it now flashes between _two_ specially picked colours (white and mid-grey), meaning that it should be visible even if your default background colour is white; and it also flashes twice rather than once.
Simon Tatham
2005-07-20 11:05:35 +00:00
0df586e23aSome attempt to explain Dominosa for those unfamiliar with dominos. (Not sure I've succeeded.)
Jacob Nevins
2005-07-19 19:33:49 +00:00
910aa99e6eAnother fix from Chris: Guess's allow-blanks mode wasn't allowing blanks...
Simon Tatham
2005-07-18 19:07:36 +00:00
6d96375736Fix to Chris's patch in r6106 (also from Chris).
Simon Tatham
2005-07-18 18:54:06 +00:00
0e68ad82a9Switch Untangle to using long' rather than int' in its internal rationals, for the sake of 16-bit-int platforms such as Palm. Thanks to James H.
Simon Tatham
2005-07-17 17:12:21 +00:00
e33a57b703Quite a few instances of the Cardinal Error of Ctype were turned up by a grep I just did. Oops.
Simon Tatham
2005-07-17 17:10:11 +00:00
8ac92e8607Two tiny cleanup patches from James H.
Simon Tatham
2005-07-17 14:49:13 +00:00
782a4f3fecGet rid of the malloc in shuffle(), by defining a subfunction memswap() which declares a fixed-size buffer on the stack and uses it multiple times if necessary.
Simon Tatham
2005-07-17 12:12:16 +00:00
a31934f233Patch from Chris Emerson: rather than dynamically calling get_correct() at (among other things) every redraw, we call it once at the creation of a new game_state to save CPU.
Simon Tatham
2005-07-17 11:15:50 +00:00
9e5d23e783Black Box: fix "reveal" button location, explain what's meant by the `firing range'
Jacob Nevins
2005-07-17 10:33:40 +00:00
257288773fUse \q{} and \by in Black Box docs.
Jacob Nevins
2005-07-17 10:13:41 +00:00
a1dc27e43aI keep forgetting to do things when adding a new puzzle, so here's a checklist.
Simon Tatham
2005-07-17 09:35:01 +00:00
9d4be786a7Bah, there's always one: failed to `svn add' blackbox.c itself!
Simon Tatham
2005-07-17 08:46:00 +00:00
e12017b291Another game from James H: `Black Box'.
Simon Tatham
2005-07-17 08:44:18 +00:00
931a7ca45fCleanups and memory leak fixes from James H.
Simon Tatham
2005-07-16 20:06:37 +00:00
e7d6c0aa33Sanity-checking patch from Phil Bordelon: since Solo can't cope with more than 36 distinct symbols (it runs out of alphanumerics), check this in validate_params. I hate to do this, since I like puzzle sizes to at least be open-ended in _principle_, but in this case there's a fundamental UI limitation which won't be fixed by getting a faster CPU.
Simon Tatham
2005-07-16 20:02:15 +00:00
a8a903db47New puzzle: `Untangle', cloned (with the addition of random grid generation) from a simple but rather fun Flash game I saw this morning.
Simon Tatham
2005-07-16 19:51:53 +00:00
c5edffdd2cImprove speed of grid generation: I've found something simple I can do during construction which massively increases (by over a factor of four with default parameters) the probability that any given randomly generated grid will be uniquely solvable.
Simon Tatham
2005-07-15 16:43:02 +00:00
606eb3f0f2Add Dominosa printout support.
Jacob Nevins
2005-07-14 22:50:58 +00:00
ee09498a41Cleanups to Solo: - use the new `shuffle' utility function in a couple of places - remove the random_state parameter from solver(). It was there because I initially wanted to use the same solver for grid generation, but since I had to abandon that plan the solver now doesn't have any need for randomness at all.
Simon Tatham
2005-07-14 18:15:23 +00:00
69410c7961New puzzle: Dominosa.
Simon Tatham
2005-07-14 17:42:01 +00:00
bb63d0d399Introduce a `shuffle' utility function.
Simon Tatham
2005-07-14 17:37:05 +00:00
3d2c442bc4game_timing_state() now has access to the game_ui. This means that whether the timer is currently going is no longer solely dependent on the current game_state: it can be dependent on more persistent information stored in the game_ui. In particular, Mines now freezes the timer permanently once you complete a grid for the first time, so that you can then backtrack through your solution process without destroying the information about how long it took you the first time through.
Simon Tatham
2005-07-10 10:17:13 +00:00
145301d0dcChange of policy on game_changed_state(). Originally, it was called by the midend every time the game state changed _other_ than as a result of make_move(), on the basis that when the game state changed due to make_move() the game backend had probably noticed anyway. However, when make_move() split up, this became more fiddly: if the game_ui had to be updated based on some property of the final game state, then execute_move() couldn't do it because it didn't have a pointer to the game_ui, but it was fiddly to do it in interpret_move() because that didn't directly have a copy of the finished game state to examine. Same Game (the only game to be affected) had to deal with this by actually having interpret_move() _call_ execute_move() to construct a temporary new game state, update the UI, and then throw it away.
Simon Tatham
2005-07-10 10:06:04 +00:00
ac36314b02Subtle UI change to Mines. Although I mostly find the unified left- button interface (same button to open a closed square or to clear around an open one) to be a massive help, there is one circumstance in which it frequently kills me: if I click down on an open square I want to clear around, then the mouse pointer accidentally drifts over on to the nearest closed square before I release, I'll end up opening that square instead and (usually) dying. So this checkin causes Mines to note which type of square I left-clicked on, and to do nothing if the button release is on the other type.
Simon Tatham
2005-07-10 09:27:08 +00:00
2ec5a51c35Alter the `Octagon' board preset so that instead of presenting you with the obvious central hole it presents you with a randomly chosen one of twelve other holes. The reason is, the central-hole starting position is provably insoluble (proof given in comments), so instead we pick from the ones that are actually possible.
Simon Tatham
2005-07-09 10:19:41 +00:00
d5fe59b25bMissing quit on error was leading to an assertion failure on some types of incorrectly formatted save file.
Simon Tatham
2005-07-06 21:24:28 +00:00
d7588e6048Move various printf()s after declarations.
Jacob Nevins
2005-07-06 20:10:03 +00:00
6ea61aa98eUnify the two solvers in Solo. nsolve has now had recursion capability added to it, to be used only when all else fails, and is simply called `solver'. This means that:
Simon Tatham
2005-07-06 18:36:20 +00:00
753339737eRefactoring from James H: the highlight and lowlight colour setup common to Fifteen, Sixteen, Twiddle and Pegs is now a utility function in misc.c.
Simon Tatham
2005-07-06 18:27:40 +00:00
d4001cbc0dSome patches from James H: - 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).
Simon Tatham
2005-07-06 11:06:17 +00:00
755d0c0b03Revert the code that assumed that incoming parameters used a random generation scheme in r6068, since this messed up the non-permanency of the non-limited parameter.
Jacob Nevins
2005-07-05 21:40:29 +00:00
f3c95109c7Add a full' parameter to validate_params(), analogous to the one in 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').
Jacob Nevins
2005-07-05 21:27:19 +00:00
968828283bEnhancements to mkfiles.pl and Recipe to arrange for the auxiliary 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.
Simon Tatham
2005-07-05 19:40:32 +00:00
4763b712fdIt's been a new year for a while now.
Jacob Nevins
2005-07-05 19:38:27 +00:00
68d0a346fdrevert supposed typo -- I have no brain
Jacob Nevins
2005-07-05 19:12:56 +00:00
5ff23cd60eAdd HACKING to main doc build.
Jacob Nevins
2005-07-05 19:11:51 +00:00
2c8d31763atypo
Jacob Nevins
2005-07-05 19:10:26 +00:00
b75ce34179Add a completion flash when you get down to a single peg.
Jacob Nevins
2005-07-05 18:57:34 +00:00
b74dac6de2Refactored the game_size() interface, which was getting really 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.
Simon Tatham
2005-07-05 18:13:31 +00:00
a4e3d69de2James Harvey points out a missing ifdef.
Simon Tatham
2005-07-05 12:03:56 +00:00
74c4a6bf27Clarify that diagonal moves are not permitted in Pegs.
Jacob Nevins
2005-07-04 21:07:40 +00:00
4bc951cebcAdd WinHelp topic.
Jacob Nevins
2005-07-04 20:06:35 +00:00
9f8533c42fThere's always one. Forgot to add Pegs to `make install'.
Simon Tatham
2005-07-04 19:55:10 +00:00