#| Preamble. 1. Please don't laugh TOO hard - I have learned all of my lisp while writing this. 2. Many thanks to Jeffrey Mark Siskind and David Allen McAllester for the wonderful Screamer. 3. Many thanks to Chris Double (www.double.co.nz) for porting it to Corman Lisp. 4. Many thanks to Roger Corman for the Corman Lisp and his decision to make availble such a fully-featured trial version. The algorithm employed is as follows: Polyomino-instances (a polyomino in particular position and orientation on the board) are represented as 64-bit integers (in the spirit of bitboard-based chess engines). Thus an intersection may be checked by loganding 2 such representations. 1. Building all feasible polyomino-instances (done at load time). 2. Building all feasible combinations of polyomino-instances covering all squares along each side of the board (done at load time). 3. Trying to combine adjacent side variants (a combination passes if its corner piece is the same, and there are no "islands" detected. An island is a region comrised of unoccupied squares (and surrounded by occupied ones), such that there is no possibility to fit any remaining piece in it. Only the most rudimentary detecion heuristics are implemented). First, north and east side-variants are combined. Island-detection looks only at this region at this point: o o o o o o o o o x x o o o o o o x x o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o Second, south is combined with the previous combination. Island-detection looks at this region: o o o o o o o o o o o o o o o o o o o o o o o o o x x o o o o o o x x o o o o o o x x o o o o o o x x o o o o o o o o o o o o o Island-detecion algorithm may consider the previously considered region if there is a connection (by unoccupied squares) between them. Third, west side-variant is combined with the current combination. Island detection considers this region: o o o o o o o o o o o x x x x o o o o x x x x o o o o x x x x o o o o x x x x o o o o x x x x o o o o x x x x o o o o o o o o o As in the previous stage, island-detecion algorithm may consider the previously considered regions if there is a connection between them. 4. Now, the attempt is made to cover the remaining unoccupied squares by remaining polyominos. The following heuristic is employed: The most-constrained unoccupied square is found (That is, the square with the least number of neighbouring onoccupied squares). Then the first non-conflicting polyomino-instance that intersects with the chosen square is chosen. Execute this: |# (load "C:\\Program Files\\Corman Technologies\\Corman Lisp 2.0\\Libraries\\screamer\\screamer.lisp") (load "utils.lisp") (load "preliminaries.lisp") (load "debug.lisp") (load "ilc-puzzle.lisp") (in-package :SCREAMER-USER) (PRINT-SOLUTION (solve)) ;one solution ;(dolist (sol (solve t)) ; (print-solution sol)) ;all solutions ;; $Id: //info.ravenbrook.com/user/ndl/lisp/contest/entries/denis-mashkevich/run.lisp#1 $