Skip to content

Commit

Permalink
ADD: puzzle analysis breaks down puzzles by rule types - first steps
Browse files Browse the repository at this point in the history
ADD: CPack now configured to make source and executable distributables
ENH: Rules now drawn nicely.
  • Loading branch information
tim.hutton committed Feb 24, 2008
1 parent 35deca6 commit b9ecc2b
Show file tree
Hide file tree
Showing 8 changed files with 202 additions and 159 deletions.
34 changes: 34 additions & 0 deletions CMakeLists.txt
Expand Up @@ -35,3 +35,37 @@ ADD_EXECUTABLE(Slinker
WIN32
${SRCS_Slinker}
)

#==============================================================================
# CPack commands - for making distributables

INSTALL(TARGETS Slinker
RUNTIME DESTINATION bin
)

INCLUDE(InstallRequiredSystemLibraries)

SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Slinker")
SET(CPACK_PACKAGE_VENDOR "")
SET(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/README.txt")
SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/COPYING.txt")
SET(CPACK_PACKAGE_VERSION_MAJOR "0")
SET(CPACK_PACKAGE_VERSION_MINOR "1")
SET(CPACK_PACKAGE_VERSION_PATCH "0")
SET(CPACK_PACKAGE_INSTALL_DIRECTORY "Slinker ${Slinker_VERSION_MAJOR}.${Slinker_VERSION_MINOR}")
IF(WIN32 AND NOT UNIX)
# There is a bug in NSI that does not handle full unix paths properly. Make
# sure there is at least one set of four (4) backlasshes.
#SET(CPACK_PACKAGE_ICON "${CMake_SOURCE_DIR}/Utilities/Release\\\\InstallIcon.bmp")
SET(CPACK_NSIS_INSTALLED_ICON_NAME "bin\\\\Slinker.exe")
SET(CPACK_NSIS_DISPLAY_NAME "${CPACK_PACKAGE_INSTALL_DIRECTORY}")
#SET(CPACK_NSIS_HELP_LINK "http:\\\\\\\\www.my-project-home-page.org")
#SET(CPACK_NSIS_URL_INFO_ABOUT "http:\\\\\\\\www.my-personal-home-page.com")
SET(CPACK_NSIS_CONTACT "tim.hutton@gmail.com")
SET(CPACK_NSIS_MODIFY_PATH ON)
ELSE(WIN32 AND NOT UNIX)
ENDIF(WIN32 AND NOT UNIX)
SET(CPACK_PACKAGE_EXECUTABLES "Slinker" "Slinker")
SET(CPACK_SOURCE_IGNORE_FILES "/\\\\.svn/" "~$") # we ignore svn things and backup files

INCLUDE(CPack)
67 changes: 58 additions & 9 deletions README.txt
@@ -1,10 +1,17 @@
Hello,
Hello,

To compile Slinker, you need wxWidgets 2.8 and CMake. It should run on any platform supported by these tools, which is many.

Contents:
=========
A. Platform-specific build instructions
B. Initial thoughts and motivation

Platform-specific Build Instructions:
=====================================


A. Platform-specific build instructions:
========================================

To compile Slinker, you need wxWidgets and CMake. It should run on any platform supported by these tools, which is many.

Linux:

Expand All @@ -22,9 +29,51 @@ Check the CMake manual for more options - you can make kdevelop projects, for ex
Windows:

1) Install wxWidgets and CMake. Install in standard locations, eg. C:\wxWidgets-2.6.4 and C:\Program File\CMake2.5
2) Run CMakeSetup.exe, and specify the source and target folders (make a 'bin' one).
3) Having specified your target compiler, keep hitting configure until done. It should find everything you need.
4) Hit 'OK' to generate the project files for your compiler.
5) Compile.
2) Build wxWidgets with your compiler. Please consult the wxWidgets documentation. For Microsoft Visual Studio,
we only need the Debug and Release builds.
3) Run CMakeSetup.exe, and specify the source and target folders (make a 'bin' one).
4) Having specified your target compiler, keep hitting configure until done. It should find everything you need.
5) Hit 'OK' to generate the project files for your compiler.
6) Build Slinker.

Please contact tim.hutton@gmail with any problems compiling Slinker.


B. Initial thoughts and motivation:
===================================

slitherlink:

2d square lattice of values: 0,1,2,3 (usually provided at start of puzzle and fixed)
borders of squares take values: 0,1 (unbonded or bonded)
also a special value for each: -1 (entry unknown)
borders are linked in one continuous loop, with no crossovers

slitherlink is NP-complete: checking that problems have unique solutions gets very expensive with
increasing size. but for a given size, e.g. 7x7, we should be able to find enough optimisations
to be able to find unique-solution puzzles

problem 1: given a blank world, with N numbers near the middle/corners/sides,
what 'rules' are there for 0, 1, 2, 3 entries provided?
(e.g. 3 above 3 means we know there are 3 horizontal borders turned on)

problem 2: can we solve all published worlds by exhaustive search in reasonable time?
can we use the rules to speed up the search? (up to ~20x20;yes)

problem 4: can we generate puzzles that have unique solutions? yes

problem 5: can we generate puzzles with a minimal number of entries provided for the size? well, for a given loop, yes.

problem 6: can we generate puzzles that are directly solvable without having to follow alternatives? yes, by simply turning
off recursion in our solver - this yields nicer puzzles without increasing the number of entries required, intriguingly.
=> the 'unwritten' rules of slitherlink: 0) each puzzle has a unique solution. -1) each puzzle is solvable
without having to explore possibilities (by deduction alone)

problem: can we cast the search problem as a CA? (yes, by having transition rules apply, for directly-solvable puzzles
we get a solution)

problem: any even-number-sized square grid with a full diagonal of 2's with all their border-pairs pointing the same way
has at least one other solution (with border-pairs pointing the other way), hence don't make good puzzles.
(BTW, any *odd*-number-sized square grid with a full diagonal of 2's has no solutions.)
What other such quirks exist?

Please contact tim.hutton@gmail with any problems compiling Slinker.
10 changes: 7 additions & 3 deletions src/App.cpp
Expand Up @@ -60,8 +60,10 @@ bool App::OnInit()

int App::OnRun()
{
try { return wxApp::OnRun(); }
catch(exception &e)
try {
return wxApp::OnRun();
}
catch(const exception &e)
{
wxMessageBox(wxString(e.what(),wxConvUTF8),
wxT("Exception thrown:"),
Expand All @@ -70,7 +72,9 @@ int App::OnRun()
}
catch(...)
{
// some other error thrown... :(
wxMessageBox(_T("Unknown exception."),
wxT("Exception thrown:"),
wxICON_EXCLAMATION);
return -1;
}
}

0 comments on commit b9ecc2b

Please sign in to comment.