Home           About           Downloads

Picture Logic solver

This program solves picture logic puzzles, and demonstrates the algorithm for a single solving pass on an individual row or column in detail.

PictureLogic.exe generates a random image, and solves it by repeatedly applying the solving passes alternately on all columns and rows.

PictureLogic_RowColAlgorithm.exe demonstrates the algorithm for applying a single solving pass to a row or column.

Controls for both PictureLogic.exe and PictureLogic_RowColAlgorithm.exe are:

'c': Commences or resumes continuous updating of the solving algorithm
'p': Pauses the continuous run.
's': Update the solver one step.
'r': Generate a new puzzle instance.
'q' or Esc: Closes the program.

For the algorithm demonstration program, there is some basic logic guiding the generation of the puzzle instances, but it can still generate unsolvable instances. However, the algorithm will detect these.

Screen layout for PictureLogic.exe:

The only thing displayed is the picture logic puzzle. This consists of the grid and block sizes, as you would see in any puzzle book.

Screen layout For PictureLogic_RowColAlgorithm.exe:

The puzzle instance is displayed in the 1D grid at the bottom: Solid rectangles indicate a cell that must be filled, hollow rectangles indicate a cell that must remain empty. Above this 1D grid are the block sizes.

Just above the puzzle instance is a 1D grid is where the results of the solving pass will appear at the end of the run.

The algorithm will enumerate every possible placement of the blocks in this 1D space during the course of the algorithm, and you can see the results of its work in the middle of the window.

At the top of the window are grids describing the "invariant" cells - the cells that stay the same for all possible placements of the blocks. These are then referred to to generate the result of the solving pass.

I hope these programs are interesting for you, and perhaps teach you about this puzzle and one way of solving it, and perhaps show the benfit of encapsulating an algorithm into an object so that you may query it and control its execution from the outside.


No comments:

Post a Comment