A 20-line solver. To play this game:...
Move to
=> <=
Darueber Spitze
See also
Calculator
Eliza
JigsawPuzzle
CAD data exchange and processing with STEP/Express ISO-10303-21
CircuitAnalysis
Othello
SymbolicMath
SMTP Client
Welding Robot
Goban
ConvertGui
IF Computer > MINERVA > Example Programs > Applications > JigsawPuzzle

JigsawPuzzle

A 20-line solver. To play this game:

  1. stack four sheets of different colored paper
  2. cut picture into jigsaw puzzle
  3. do four puzzles so that adjoining pieces get different colors

Now matter how wild your scissor art is, there is always a solution to the puzzle. This -if my memory is correct- is guaranteed by some clever guys of the University of Illinois who solved the infamous 4 color problem and proved that 4 colors suffice.

The MINERVA program that computes the solution is brute force search, about 20 lines. The puzzle is given in 60 or so lines, the other programs are for drawing.

The program illustrates a fairly rich set of techniques

  • Use of exhaustive search to find one or all solutions
  • Use of declarations to describe the puzzle
  • Using blackboards to store results
  • Use of package, external, init directives
  • Use of predicate names with underscore prefix for privacy
  • Use of main/1 in several modules for testing purposes
  • Use of Java classes and their methods
  • Working many windows
  • using a GUI with 'action' and 'paint' events

Notes: The 'Show All Solutions' button will produce 192 new windows for this example; repeated use will quickly exhaust your Windowing resources.

Netscape 4.0 may not execute this example properly.

read on...
MINERVA
ifcomputer logo
f
Expert Services on the Web
Sprache
English
Japanese
Server
USA
Japan
Site Access
Local Index
Local Contents
Site Contents
Site Index
Printer Friendly
For imode
For PDA
Search
document: http://www.ifcomputer.co.jp/MINERVA/ExamplePrograms/Applications/JigsawPuzzle/home_de.html
published 2008/7/21 update 2001/3/21 (c) 1996-2006 IF Computer Japan
IF Computer 5-28-2 Sendagi, Bunkyo-ku Tel +81-3-5814-3352 info@ifcomputer.com
Customer Support Tokyo 113-0022 Japan   http://www.ifcomputer.com
scroll to top managed with ubiCMS