c4e486c2a1In Group, the keyboard-controlled cursor should respect user rearrangement of the rows and columns.
Simon Tatham
2011-12-21 13:46:48 +00:00
3107237af4Remove the 'cheated' flag in Range's game_ui, which was stickily remembering whether the player had ever used the hint or solve functions, even if they then pressed undo (and even if they saved and restored).
Simon Tatham
2011-09-18 07:43:19 +00:00
295fb9fd83When we run out of background colours for chains and wrap back to the beginning, we should wrap back to COL_B0+1 rather than COL_B0 itself, so as not to reuse white. White should be special, and always indicate a properly numbered square.
Simon Tatham
2011-09-18 07:43:18 +00:00
7f8919952fPatch from Chris Boyle to fix Signpost's labelling when you have more than 26 separate linked chains of unnumbered squares: we now wrap from 'z' to an Excel-like 'aa', 'ab', ..., instead of falling off z into punctuation and control characters.
Simon Tatham
2011-09-18 07:43:18 +00:00
73daff3937Changed my mind about midend_is_solved: I've now reprototyped it as midend_status(), and given it three return codes for win, (permanent) loss and game-still-in-play. Depending on what the front end wants to use it for, it may find any or all of these three states worth distinguishing from each other.
Simon Tatham
2011-06-19 13:43:35 +00:00
8dcdb33b77Pass background colour as a parameter to draw_gts and draw_adjs, so that we can pass -1 in calls from game_print(). Fixes a printing bug in which all the adjs and gts were overlaid with giant black rectangles! (Because COL_BACKGROUND doesn't mean the same thing in that context.)
Simon Tatham
2011-05-22 07:07:47 +00:00
004ef73480Fix segfault in Loopy printing, introduced when I added the dynamic arrays 'textx' and 'texty' to the game_drawstate but failed to initialise them in the temporary drawstate used by game_print(). Thanks to Arun Giridhar for spotting this.
Simon Tatham
2011-05-11 18:11:28 +00:00
bd539ae870Having played Keen a bit following the clue-generation fix in r9165, I've decided that the extremely low density of one-option multiplication clues is not a universally good idea after all: it seems to me to make puzzles _quantitatively_ harder, even if Keen's difficulty-level system can't see any difference in the set of modes of reasoning required at least once to solve the grid.
Simon Tatham
2011-05-07 13:22:17 +00:00
4a172274f2Apply the rotation in Penrose grid descriptions by rotating in the 4-vector representation, rather than mucking about with sines and cosines after grid generation. _Should_ make no difference in the generated grids (there's a theoretical risk of an unlucky rounding error just about managing to push some point in or out of bounds, but I think it's vanishingly small), but simplifies the coordinate- flattening procedure, and in particular increases its chance of getting vertical lines actually vertical.
Simon Tatham
2011-05-06 17:09:03 +00:00
5619904bccApply a missing bit of r9164, which only broke the build with -DDEBUGGING so I didn't notice it at the time.
Simon Tatham
2011-05-05 17:13:16 +00:00
89bfecaa5aPortability fixes, mostly from James for Palm purposes. Mostly additions of missing 'static' and explicit 'void' in parameter lists, plus one or two other things like explicitly casting chars in variadic argument lists to int and using DBL_MAX if HUGE_VAL isn't available.
Simon Tatham
2011-05-04 18:41:21 +00:00
e7b2a9dd8dHaving looked at Keen's clue selection code, I also notice that the intended behaviour of classifying multiplication clues as low-quality if they only left one possible pair of multiplicands has never actually worked, because I should have compared the possible clue count against 2 rather than 1 since the multiplicands can occur either way round.
Simon Tatham
2011-05-04 18:22:15 +00:00
2efc77d2fdFix warnings generated by gcc 4.6.0 about variables set but not thereafter read. Most of these changes are just removal of pointless stuff or trivial reorganisations; one change is actually substantive, and fixes a bug in Keen's clue selection (the variable 'bad' was unreferenced not because I shouldn't have set it, but because I _should_ have referenced it!).
Simon Tatham
2011-05-04 18:22:14 +00:00
4bab5e531bFix two memory leaks reported by Tiago Dionizio in recent Loopy development.
Simon Tatham
2011-04-26 13:44:27 +00:00
8266b71475Forgot to set 'has_incentre' on triangular grids, which don't use grid_face_add_new(). Oops.
Simon Tatham
2011-04-25 22:41:54 +00:00
62c20496bfFrom James Harvey (via a period of collaborative polishing), a patch to add two kinds of Penrose tiling to the grid types supported by Loopy.
Simon Tatham
2011-04-24 09:10:52 +00:00
f390d0d7ffOops: initialise that new 'has_incentre' flag to false, otherwise the game will sometimes pick random incentres in place of the carefully computed ones. Ahem.
Simon Tatham
2011-04-23 13:03:38 +00:00
5e3de7d95bMove most of face_text_pos() into grid.c, leaving in loopy.c only the part that converts from abstract grid coordinates into screen coordinates. This should speed up window-resizing by eliminating pointless reiteration of the complicated part of the algorithm: now when a game_drawstate is renewed, only the conversion into screen coordinates has to be redone.
Simon Tatham
2011-04-23 11:44:43 +00:00
0a547b2451Replace my brute-force algorithm in face_text_pos with a more complex but faster and more mathematically sensible one.
Simon Tatham
2011-04-23 11:44:41 +00:00
079e0d1328Stop calling face_text_pos() for faces that don't need to have text in them anyway. It's slow and pointless.
Simon Tatham
2011-04-23 11:44:41 +00:00
8713e2fa81Support user-specified extra link flags (XLFLAGS) in the Unix makefile. Makes it easy to recompile for things like profiling.
Simon Tatham
2011-04-23 11:37:46 +00:00
3e0822228aFix mismatch between printf format strings and arguments in some solosolver verbose diagnostics in X mode. Also added gcc-specific prototypes with __attribute__((format)) to ensure they all get checked in future.
Simon Tatham
2011-04-11 17:32:44 +00:00
91f5f585b2Remove a stray diagnostic.
Simon Tatham
2011-04-05 18:05:57 +00:00
e9b8589710Fix an amusing cut-and-paste error in the Java drawing code which was causing complete mis-draws - but only when the window was exactly the right size!
Simon Tatham
2011-04-05 18:05:57 +00:00
5d503a52dbAdjust the yellow used for LINE_UNKNOWN so that it's always a bit darker than the background, because the Java front end demonstrates that it's a bit eyewatering when it _matches_ the background.
Simon Tatham
2011-04-05 17:45:48 +00:00
4594df97a9Trivial markup fix.
Simon Tatham
2011-04-03 09:16:08 +00:00
9ece2832ceAdd a new deduction to Easy level, which is as small as I can make it to have the effect of enabling large Easy-level grids to be constructed in all grid types. Without this, some generations at Easy level (e.g. 'loopy --generate 1 7x7t9de') can spin forever because _even with all clues filled in_ the generated grids can't be solved at that level.
Simon Tatham
2011-04-03 07:59:35 +00:00
2054da9f68Move up midend_is_solved() in the developer docs from subheading to heading level. It's _almost_ apt to have it as a subheading of midend_solve(), but not quite, and it certainly wasn't intentional - I must have absentmindedly typed the wrong Halibut command letter.
Simon Tatham
2011-04-03 07:55:18 +00:00
980880be1fAdd a function to every game backend which indicates whether a game state is in a solved position, and a midend function wrapping it.
Simon Tatham
2011-04-02 16:19:12 +00:00
8c6c8df8f4Add functions provided by the midend to tell a front end whether GUI buttons for undo and redo should currently be greyed out.
Simon Tatham
2011-04-02 15:36:30 +00:00
00a313f2d6Rework the Loopy grid drawing algorithm so that it doesn't assume when it clears a clipping region that it knows what features will need redrawing in that region. Instead, I've moved all the clip/unclip/draw functionality out into a game_redraw_in_rect() function which checks _everything_ on the grid to see if it lies in the region.
Simon Tatham
2011-04-02 15:19:29 +00:00
3c26b651a6Improve the algorithm for figuring out where the number should be drawn in a face: averaging the vertex positions works fine for regular or roughly regular convex polygons, but it'll start being a pain for odder or concave ones.
Simon Tatham
2011-04-02 15:19:29 +00:00
86f3385d3dWhen a lot of edges meet the same point - and, in particular, when they meet at sharp enough angles that the thick lines overlap noticeably outside the circle of the point - redrawing the edges in a different order each time looks ugly. Arrange to always redraw edges in order of colour, so that empty lines are drawn before indeterminate lines which in turn come before filled-in lines.
Simon Tatham
2011-04-02 13:15:56 +00:00
7b2b742be8Another patch from Chris Moore implementing two more grid types, both involving dodecagons.
Simon Tatham
2011-02-24 19:06:49 +00:00
621649491dRetire the 'middle_face' field in 'struct grid', together with the overly complicated algorithm that uses it to home in on the grid edge closest to a mouse click. That algorithm is being stressed beyond its limit by the new grid type, and it's unnecessary anyway given that no sensibly sized puzzle grid is going to be big enough to make it prohibitively expensive just to do the trivial approach of iterating over all edges and finding the closest of the eligible ones.
Simon Tatham
2011-02-24 19:06:48 +00:00
53f6e4c6cbPatch from Chris Moore to implement an extra grid type, the 'floret' pentagonal tiling.
Simon Tatham
2011-02-23 20:05:42 +00:00
1a628aebd8Patch from Chris Moore to improve the generality of grid_nearest_edge(), by having it search harder for a better dot to move to in the first loop.
Simon Tatham
2011-02-23 20:05:40 +00:00
b2e4437d5bAnother UI feature for Group: now you can click between two legend elements to toggle thick lines in the grid. Helps to delineate subgroups and cosets, so it's easier to remember what you can legitimately fill in by associativity.
Simon Tatham
2011-02-08 22:13:18 +00:00
fd98870bffThe printing function in Bridges was unable to cope with more than two bridges between a pair of islands! Good grief. How did we never spot that before?
Simon Tatham
2011-02-03 19:49:19 +00:00
540716194dFix error highlighting after table rearrangement.
Simon Tatham
2011-01-09 11:30:09 +00:00
48f6bfa474Add the ability to reorder the rows and columns in Group. It becomes much easier to keep track of things if, once you've identified a cyclic subgroup, you can move it into a contiguous correctly ordered block.
Simon Tatham
2011-01-08 15:53:25 +00:00
f9eca22196Introduce a mechanism in Buildscr for optionally building some of the (more finished) puzzles in 'unfinished', as Java applets only. (The rationale being: puzzles in 'unfinished' can be played locally by people who go to the extra effort of downloading and building the source, but to play them in Java is particularly inconvenient unless I build the Java version myself. I just won't link it from the front page.)
Simon Tatham
2011-01-06 18:37:05 +00:00
cca76ce6dcAlso, it's ugly to blank out pieces of the applet window in black. Use the puzzle background colour, like the GTK front end does.
Simon Tatham
2010-11-06 18:14:42 +00:00
9cfc61c5f7In the Java front end, don't try to guess the puzzle rectangle's width and height by assuming mirror symmetry within the containing applet area. Instead, use the proper width and height as given back by the C sizing function.
Simon Tatham
2010-11-06 18:14:41 +00:00
4d41f0f717Fixes to r8997: firstly, move the fix out of #ifdef CAIRO so that it applies to both drawing mechanisms, and secondly, make sure to paint the spare pieces of window in the _puzzle's_ background colour rather than the (sometimes slightly different) system default.
Simon Tatham
2010-11-06 17:47:46 +00:00
64e78f644cLiam Clarke points out that the use of the word 'radius' to describe the size of the rotating sections in Twiddle is a misnomer, since it's actually measuring something more like the diameter of the section. Replace the word throughout with 'rotating block size' or similar.
Simon Tatham
2010-10-01 11:46:32 +00:00
f1ad38971cMemory leak fixes from Jonas Koelker.
Simon Tatham
2010-09-20 10:36:44 +00:00
26c669a6b2Jonas Koelker reports that using the version of GTK currently in Debian sid (2.20.1), there's a redraw problem when the window has a different aspect ratio from the puzzle (due to resizing or maximising): pieces of the window outside the real puzzle rectangle don't get redrawn when exposed (e.g. by the drop-down menus).
Simon Tatham
2010-09-14 10:55:06 +00:00
d14999949cNew puzzle from Jonas Koelker: 'Range', an implementation of the puzzle variously known (depending on which website you look at) as Kurodoko, Kuromasu or 'Where is Black Cells'.
Simon Tatham
2010-09-14 09:31:52 +00:00
b96a99042bPatch from Jonas Koelker to fix a double free in magnetssolver.
Simon Tatham
2010-07-04 22:57:05 +00:00
795ef3c137Some minor fixes to the unfinished Pearl solver: - move critical correctness checks out of diagnostic ifdefs (ahem) - move declarations to before conditionally compiled code (we don't build in C99 mode round here) - tidy up an unsightly blank line while I'm here.
Simon Tatham
2010-06-27 11:17:27 +00:00
3dc6adba5eSome kernels don't like my #! line. Move the -w into a 'use warnings;' to make it simpler.
Simon Tatham
2010-05-30 22:48:31 +00:00
d5c848b92fPatch from Mark Wooding to add documentation of the new draw_thick_line function, and also add some general thoughts on how to draw puzzles' windows in an antialiasing-friendly way.
Simon Tatham
2010-05-29 15:43:52 +00:00
8589cb3a0cPatch from Mark Wooding to add antialiasing-safety in repeated redrawing of inequality signs in Unequal (which are redrawn when they change colour).
Simon Tatham
2010-05-29 15:43:50 +00:00
4b0a8c03a6Patch from Mark Wooding to reorganise Loopy's redraw function to be properly antialiasing-safe: all redraws are now done by clearing a rectangle of the image, clipping to that rectangle, and redrawing everything in it exactly once.
Simon Tatham
2010-05-29 15:43:48 +00:00
9cd182ffa9Patch from Mark Wooding to introduce a draw_thick_line() function in the drawing API, for use by Loopy. It's optional: drawing.c will construct an acceptable alternative using a filled polygon if the front end doesn't provide it.
Simon Tatham
2010-05-29 15:43:46 +00:00
ef6e78c6acPatch from Mark Wooding to (optionally at compile time) use the Cairo rendering library in place of GDK, which provides pretty antialiased graphics much like we get on MacOS. Inertia and Untangle are perhaps the two games most obviously improved by this.
Simon Tatham
2010-05-29 15:43:42 +00:00
9ce82b0febPatch from Mark Wooding to disable GTK's internal double buffering, which I didn't know about, but which is clearly a waste of effort since we keep our own backing pixmap for the puzzle window.
Simon Tatham
2010-05-29 15:43:41 +00:00
d040a921baPatch from Mark Wooding to use GTK stock items for standard 'OK', 'Yes' and 'No' buttons, which means they get the standard icons that go on those button types. Also reorders yes/no boxes so that they're the GNOME standard way round.
Simon Tatham
2010-05-29 15:43:40 +00:00
0a4c832e9bMake mkfiles.pl clean under 'perl -w'. Fixes one minor bug in the output (a comment from Recipe mistakenly got into the Unix makefile); more importantly, lets mkfiles.pl run in up-to-date Perls (where implicit split to @_ is now obsolete).
Simon Tatham
2010-05-29 13:44:12 +00:00
19fa275b6aPatch from Ben Hutchings to fix an error-checking goof: Keen division clues were failing to light up as erroneous if the quotient of the numbers in them came out right under rounded-down C integer division (e.g. 2 and 5 would be accepted for a 2/ clue). Apparently I copied the code that invents clues in the generator straight into the solution checker, without remembering that the generator was allowed to do it that way because exact divisibility had been checked elsewhere.
Simon Tatham
2010-05-16 06:58:09 +00:00
c539872613A user points out that Signpost doesn't in fact use the numeric keypad, so it shouldn't have the REQUIRE_NUMPAD flag.
Simon Tatham
2010-05-09 07:22:16 +00:00
177f4c1974Fix a build-breaking bug I introduced to the OS X makefile in r8931. (Missed off the explicit -o from the compile lines constructing version.{i386,ppc}.o, causing both to be compiled as version.o and dependent build steps to fail.)
Simon Tatham
2010-04-26 17:26:38 +00:00
36cee4e279Modification of a patch from Debian: eliminate the endless rebuilds of basically unchanged binaries due to the compulsory rebuild of version.o. version.o now depends normally on version2.def, which is constructed using much the same if statements that version.o used to use, except that it's not overwritten at all if its contents don't need to change.
Simon Tatham
2010-04-25 14:57:21 +00:00
178f87a79ePatch idea from Debian, but modified considerably in implementation: introduce a new colour in Slant (COL_FILLEDSQUARE) which is used for the background of any grid square that has a diagonal line in it. This makes it easier to spot the one square on a giant board you forgot to fill in, but on the other hand I found it to look very strange and disconcerting. So I've set the colour to be identical to COL_BACKGROUND by default, and users who like the idea can enable it by environment variable or by local patch.
Simon Tatham
2010-04-25 14:57:20 +00:00
5062bee2ecPatch from Debian, to bring the use of the X selection/clipboard in line with freedesktop.org. (This is relatively simple for Puzzles, since it only writes to the clipboard and never reads it, so the question of which selection to use when is most easily dealt with by always writing to both.)
Simon Tatham
2010-04-25 14:57:19 +00:00
68bc396b7bWording tweaks inspired by (but not the same as) some in a Debian downstream patch.
Simon Tatham
2010-04-18 15:07:54 +00:00
b7e0d854fePatch from Ben Hutchings: explicitly initialise something which some gccs complained about.
Simon Tatham
2010-04-18 15:07:52 +00:00
0a9b0a7384Fix incorrect uses of ctype.h (passing it uncast chars, or other things potentially not in the range 0..255).
Simon Tatham
2010-04-17 13:27:15 +00:00
945d8f0a3aFix from James H for an assertion failure during Signpost generation. To reproduce, try 'signpost --generate 1 7x7#12345-162'.
Simon Tatham
2010-04-17 13:27:12 +00:00
c0f8b08833Add '-v' option to patternsolver, to make it show its working.
Simon Tatham
2010-04-02 10:20:58 +00:00
8e74bbae6bDylan O'Donnell reports that Signpost hangs on trying to generate a 2x2 puzzle. Rule it out in validate_params().
Simon Tatham
2010-04-02 07:21:34 +00:00
50b6e0d708Chris Boyle reports an off-by-two error ('a Qui-Gon Jinx' :-) in difficulty selection in Unequal's solver. I suspect I missed this when I refactored latin.c and its callers.
Simon Tatham
2010-03-21 14:30:49 +00:00
5627dc4049Error highlighting bug in Bridges: when counting the number of extra bridges that could go to an island, the game was not correctly accounting for existing bridges in all circumstances.
Simon Tatham
2010-03-21 08:48:29 +00:00
d437253ecaAnother w/h transposition typo.
Simon Tatham
2010-02-24 19:30:03 +00:00
b4ca687c02Typo affecting gameplay on grids wider than they are tall. (Clicking in columns with x > h was being erroneously rejected.)
Simon Tatham
2010-02-24 18:06:59 +00:00
66aef80d62Fixes from James H to the numbering of squares, in particular: - sometimes two regions would get the same letter - immutable numbers could sometimes be modified - immutable numbers are now not flagged as errors when they clash (same as Solo's policy)
Simon Tatham
2010-02-22 23:14:46 +00:00
d54bbdadeeFix build failure on MacOS by initialising a variable which was reported as potentially-unused. (In fact, as far as I can tell, it's only ever uninitialised in assertion-failing code paths, so not a real bug.)
Simon Tatham
2010-02-18 18:12:12 +00:00
7011d13ae7A proper fix from James H for the negative number issue: the assertion I crudely commented out has now been replaced with code that clearly shows what you did wrong in the failing situation.
Simon Tatham
2010-02-17 19:15:04 +00:00
fabfc2caedTypo fix (from Debian).
Jacob Nevins
2010-02-17 02:37:40 +00:00
4a1ea06f49Capitalisation glitch.
Simon Tatham
2010-02-16 21:49:17 +00:00
2887a1da69'Fix' an assertion failure during play: accidentally connecting a long chain to a square numbered so low that the start of the chain would have to go into negative numbers should not crash the game, particularly when it happens as a momentary in-passing illustration.
Simon Tatham
2010-02-16 15:13:28 +00:00
b39f9dfb99Docs and comments fixes from James H.
Simon Tatham
2010-02-16 10:48:25 +00:00
1fa6d1b7f1Updates to the new-puzzle checklist, since the world has moved on.
Simon Tatham
2010-02-15 21:31:58 +00:00
7e4f870f6dNew puzzle! Setting what might be a record for how long we've sat on a puzzle before it was ready to commit, here is 'Signpost': a clone of janko.at's "Arrow Path", by James Harvey.
Simon Tatham
2010-02-15 21:09:09 +00:00
b0ad387d05Patch inspired by one from James H: remove spurious references to $mw (it should only ever have been used in the Cygwin makefile), and move the libraries to the end of the link line in the Unix makefile for better portability.
Simon Tatham
2010-01-19 00:56:37 +00:00
f55dc67f43Fix from James H: the shared code between drawing and printing should use state->adjacent rather than ds->adjacent, because the latter won't be initialised in printing mode.
Simon Tatham
2010-01-18 21:23:27 +00:00
9f96c12e9fFix from James H: in printing mode, the shared code between drawing and printing must avoid referring to stuff in the game_drawstate, since the game_drawstate isn't a real one.
Simon Tatham
2010-01-18 21:23:26 +00:00
3c6280ef8bMemory leak fix from James H.
Simon Tatham
2010-01-18 21:23:25 +00:00
6b650f894cPatch from James H to fix a bug in which ambiguous puzzles would occasionally be generated, e.g. by 8x8de#417341658689473 .
Simon Tatham
2010-01-17 01:05:55 +00:00
6d5493300fTypo/formatting fixes for Magnets documentation.
Jacob Nevins
2010-01-16 13:03:36 +00:00
4a9961a572Highlight the sides as well as the top of a tower when it's selected. I think this is a more or less aesthetically neutral change for the actual selection, but the selection code is reused to draw the victory flash and that's greatly improved by not having the tower sides remain unflashed.
Simon Tatham
2010-01-16 12:38:15 +00:00
854f4b2386Don't use payload strings directly as the format for printf.
Simon Tatham
2010-01-13 19:25:57 +00:00
65b37d5dd5Placate optimiser.
Simon Tatham
2010-01-13 19:25:56 +00:00
0d0619868dNew puzzle from James H: 'Magnets'.
Simon Tatham
2010-01-13 19:12:32 +00:00
deb5e1e5b4Couple of small changes to Singles from James H which missed my main commit: tweak the grid generation a bit, and fix the use of the Solve function on a grid containing errors.
Simon Tatham
2010-01-12 23:32:23 +00:00
b3af872f3cPatch from James H: make the Windows debugging output conditional on an enabling environment variable.
Simon Tatham
2010-01-12 23:32:22 +00:00
7aefa1110aAdd a couple more checks to the 3d collision detection, without which a click miles above the invisible RH surface of a tower would sometimes select that tower.
Simon Tatham
2010-01-12 18:34:06 +00:00
f3d39a0abbCorrections to Singles documentation, plus index terms.
Jacob Nevins
2010-01-11 22:46:02 +00:00
af0bfd07d3Misspelled keyword.
Simon Tatham
2010-01-11 21:27:37 +00:00