mirror of
git://git.tartarus.org/simon/puzzles.git
synced 2025-04-21 08:01:30 -07:00

In identity-hidden mode, as soon as you find any table entry that matches the element indexing its row or column (i.e. a product of group elements of the form ab=a or ab=b), then you immediately know which element is the group identity, and you can fill in the rest of its row and column trivially. But the Group solver was not actually able to do this deduction. Proof: it couldn't solve the game id 4i:1d1d1d1, which is trivial if you take this into account. (a^2=a, so a is the identity, and once you fill in ax=xa=x for all x, the rest of the grid is forced.) So I've added dedicated piece of logic to spot the group identity as soon as anything in its row and column is filled in. Now that puzzle can be solved. (A thing that I _haven't_ done here is the higher-level deduction of determining the identity by elimination. Any table entry that _doesn't_ match either its row or column rules out both the row and the column from being the group identity - so as soon as you have enough table entries to rule out all but one element, you know the identity must be the remaining one. At the moment, this is just doing the simple version of the deduction where a single table entry tells you what _is_ the identity.) One slightly tricky part is that because this new identity inference deduction fills in multiple grid entries at a time, it has to be careful to avoid triggering an assertion failure if the puzzle is inconsistent - before filling in each entry, it has to make sure the value it wants to fill in has not been ruled out by something it filled in already. Without that care, an insoluble puzzle can cause the solver to crash - and worse, the same can happen on an insoluble _branch_ of the guesswork-and-backtracking tree in Unreasonable mode. In both cases, the answer is to make sure you detect the problem before hitting the assertion, and return -1 for 'inconsistent puzzle' if you spot it. Then any guesswork branch that ends up in this situation is cleanly abandoned, and we move on to another one.
This is the README accompanying the source code to Simon Tatham's puzzle collection. The collection's web site is at <https://www.chiark.greenend.org.uk/~sgtatham/puzzles/>. If you've obtained the source code by downloading a .tar.gz archive from the Puzzles web site, you should find several Makefiles in the source code. However, if you've checked the source code out from the Puzzles git repository, you won't find the Makefiles: they're automatically generated by `mkfiles.pl', so run that to create them. The Makefiles include: - `Makefile.am', together with the static `configure.ac', is intended as input to automake. Run `mkauto.sh' to turn these into a configure script and Makefile.in, after which you can then run `./configure' to create an actual Unix Makefile. - `Makefile.vc' should work under MS Visual C++ on Windows. Run 'nmake /f Makefile.vc' in a Visual Studio command prompt. - `Makefile.cyg' should work under Cygwin / MinGW. With appropriate tweaks and setting of TOOLPATH, it should work for both compiling on Windows and cross-compiling on Unix. - `Makefile.osx' should work under Mac OS X, provided the Xcode tools are installed. It builds a single monolithic OS X application capable of running any of the puzzles, or even more than one of them at a time. - `Makefile.wce' should work under MS eMbedded Visual C++ on Windows and the Pocket PC SDK; it builds Pocket PC binaries. Many of these Makefiles build a program called `nullgame' in addition to the actual game binaries. This program doesn't do anything; it's just a template for people to start from when adding a new game to the collection, and it's compiled every time to ensure that it _does_ compile and link successfully (because otherwise it wouldn't be much use as a template). Once it's built, you can run it if you really want to (but it's very boring), and then you should ignore it. DO NOT EDIT THE MAKEFILES DIRECTLY, if you plan to send any changes back to the maintainer. The makefiles are generated automatically by the Perl script `mkfiles.pl' from the file `Recipe' and the various .R files. If you need to change the makefiles as part of a patch, you should change Recipe, *.R, and/or mkfiles.pl. The manual is provided in Windows Help format for the Windows build; in text format for anyone who needs it; and in HTML for the Mac OS X application and for the web site. It is generated from a Halibut source file (puzzles.but), which is the preferred form for modification. To generate the manual in other formats, rebuild it, or learn about Halibut, visit the Halibut website at <https://www.chiark.greenend.org.uk/~sgtatham/halibut/>.
Description
Languages
C
93.3%
JavaScript
1.4%
Objective-C
1.1%
CMake
1.1%
HTML
0.8%
Other
2.2%