aboutsummaryrefslogtreecommitdiff
path: root/unfinished/numgame.c (follow)
Commit message (Collapse)AuthorAge
* Fall back to <math.h> if <tgmath.h> doesn't work.Simon Tatham2023-04-06
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This fixes a build failure introduced by commit 2e48ce132e011e8 yesterday. When I saw that commit I expected the most likely problem would be in the NestedVM build, which is currently the thing with the most most out-of-date C implementation. And indeed the NestedVM toolchain doesn't have <tgmath.h> - but much more surprisingly, our _Windows_ builds failed too, with a compile error inside <tgmath.h> itself! I haven't looked closely into the problem yet. Our Windows builds are done with clang, which comes with its own <tgmath.h> superseding the standard Windows one. So you'd _hope_ that clang could make sense of its own header! But perhaps the problem is that this is an unusual compile mode and hasn't been tested. My fix is to simply add a cmake check for <tgmath.h> - which doesn't just check the file's existence, it actually tries compiling a file that #includes it, so it will detect 'file exists but is mysteriously broken' just as easily as 'not there at all'. So this makes the builds start working again, precisely on Ben's theory of opportunistically using <tgmath.h> where possible and falling back to <math.h> otherwise. It looks ugly, though! I'm half tempted to make a new header file whose job is to include a standard set of system headers, just so that that nasty #ifdef doesn't have to sit at the top of almost all the source files. But for the moment this at least gets the build working again.
* Replace <math.h> with <tgmath.h> throughoutBen Harris2023-04-04
| | | | | | | | | | | | | | | C89 provided only double-precision mathematical functions (sin() etc), and so despite using single-precision elsewhere, those are what Puzzles has traditionally used. C99 introduced single-precision equivalents (sinf() etc), and I hope it's been long enough that we can safely use them. Maybe they'll even be faster. Rather than directly use the single-precision functions, though, we use the magic macros from <tgmath.h> that automatically choose the precision of mathematical functions based on their arguments. This has the advantage that we only need to change which header we include, and thus that we can switch back again if some platform has trouble with the new header.
* Replace a buch of "const static" with "static const"Ben Harris2023-02-18
| | | | C18 section 6.11.5 says that "const static" is obsolescent.
* Mark many more function (and some objects) staticBen Harris2023-02-18
| | | | | | | | | | | | | I noticed commit db3b531e2cab765a00475054d2e9046c9d0437d3 in the history where Simon added a bunch of "static" qualifiers. That suggested that consistently marking internal functions "static" is desirable, so I tried a build using GCC's -Wmissing-declarations, which requires prior declaration (presumed to be in a header file) of all global functions. This commit makes the GTK build clean under GCC's -Wmissing-declarations. I've also adding "static" to a few obviously internal objects, but GCC doesn't complain about those so I certainly haven't got them all.
* Fix bit rot in the 'unfinished' subdir.Simon Tatham2021-03-29
| | | | | | | | | | | | Several of the source files here won't quite compile any more, because of minor things like const-correctness and the UI_UPDATE change. Now they should all build again (without prejudice to how useful they are once they have built). The biggest change was to remove the fatal() implementation from the standalone path.c, because my new plan is that basically everything that's not linked against a true puzzle frontend will be linked against nullfe.c, which provides that function anyway.
* Replace TRUE/FALSE with C99 true/false throughout.Simon Tatham2018-11-13
| | | | | | This commit removes the old #defines of TRUE and FALSE from puzzles.h, and does a mechanical search-and-replace throughout the code to replace them with the C99 standard lowercase spellings.
* Fix a printf 64-bit-cleanness error.Simon Tatham2013-11-28
| | | | [originally from svn r10098]
* Correction from James H: sqrt(0) shouldn't occur any more thanSimon Tatham2008-07-05
| | | | | | sqrt(1) should. [originally from svn r8108]
* More operations and bug fixes from James H.Simon Tatham2008-07-05
| | | | [originally from svn r8107]
* James H has helpfully provided yet more silly operators for the -ASimon Tatham2008-06-24
| | | | | | | mode. I think some user-defined ruleset configuration options are now required... [originally from svn r8092]
* An option to enable a debugging mode for the BFS.Simon Tatham2008-06-23
| | | | [originally from svn r8091]
* New -A mode permitting even madder operators, and also -m to try toSimon Tatham2008-06-09
| | | | | | | print all possible paths to a value. The latter has a lot of de-duplication left to be done, due to multiple evaluation orders. [originally from svn r8061]
* I'm sick and tired of having unfinished puzzle code lying around onSimon Tatham2006-10-29
several different systems in strange directories. So I'm creating an `unfinished' directory within source control, and centralising all my half-finished, half-baked or otherwise half-arsed puzzle implementations into it. Herewith Sokoban (playable but rubbish generation), Pearl (Masyu - rubbish generation and nothing else), Path (Number Link - rubbish generation and nothing else) and NumGame (the Countdown numbers game - currently just a solver and not even a generator yet). [originally from svn r6883]