1. Rhys
  2. nmpuzzle


nmpuzzle /

Filename Size Date modified Message
78 B
35.1 KB
11.6 KB
2.0 KB
12.9 KB
54 B
89 B
78 B
2.5 KB
736 B


A general solution to the NxM puzzle using tree search, in Literate Haskell.


You'll need Cabal. If you don't have it, grab the Haskell Platform for your preferred operating system.


$ cabal build

Then run:

$ dist/build/nmpuzzle/nmpuzzle


This application is written in Literate Haskell. You can use lhs2TeX to create nice TeX documents, or just read the .lhs files in a text editor. For the former, you can install lhs2TeX via Cabal:

$ cabal install lhs2TeX

and then use the included doc.sh script to create pdfs:

$ ./doc.sh Search
$ ./doc.sh NMPuzzle

Non-Linux users can read doc.sh and locate equivalent commands.


  • Breadth-first search
  • Depth-first search
  • Greedy best-first search
  • A* search
  • Iterative deepening depth-first search
  • Iterative deepening greedy best-first search


  • Brent Yorgey & Louis Wasserman for the split package.
  • Leon P Smith for the data-ordlist package.
  • Authors of the Haskell Platform packages.
  • Authors of documents referenced in literate code.


(c) Rhys ! 2014

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.