Paint-By-Numbers Puzzle Chanwit Suebsureekul CS491B Spring 2006 Chanwit Suebsureekul CS491B Spring...
-
date post
21-Dec-2015 -
Category
Documents
-
view
218 -
download
2
Transcript of Paint-By-Numbers Puzzle Chanwit Suebsureekul CS491B Spring 2006 Chanwit Suebsureekul CS491B Spring...
Paint-By-Numbers Puzzle
Paint-By-Numbers Puzzle
Chanwit Suebsureekul
CS491B Spring 2006
Chanwit Suebsureekul
CS491B Spring 2006
2
Chanwit Suebsureekul - California State University, Los Angeles - PBN
Introduction
• The black cells are hiding
• Find them!
• Use numbers as clues
3
Chanwit Suebsureekul - California State University, Los Angeles - PBN
The Rule
• Each number represents the number of contiguouscontiguous black cells, called a blockblock
• There must be “at leastat least” one space between blocks
• The blocks are in the same same sequencesequence as the numbers
4
Chanwit Suebsureekul - California State University, Los Angeles - PBN
Motivation
• Mario’s Picross
• Can we make the computer think
5
Chanwit Suebsureekul - California State University, Los Angeles - PBN
Objective
• Puzzle Solver
• Game
• Puzzle Editor– Edit by numbers– Edit by painting
6
Chanwit Suebsureekul - California State University, Los Angeles - PBN
Technology
• J2SE 5.0
• Java Advanced Imaging (JAI)
• Javagram
7
Chanwit Suebsureekul - California State University, Los Angeles - PBN
JAI
• Advance Image Processing
• Support standard image file formats– BMP, GIF, JPEG, PNG, TIFF, etc.
Original64x64
Resized20x20
Grayscale Monochrome
8
Chanwit Suebsureekul - California State University, Los Angeles - PBN
Javagram
• Created by Steven Simpson
• Solve a puzzle one line at a time• LineSolver class
– FastLineSolver– CompleteLineSolver
9
Chanwit Suebsureekul - California State University, Los Angeles - PBN
FastLineSolver
• Use the “Pushing Technique”– Push to the left– Push to the right– Look for the overlap
10
Chanwit Suebsureekul - California State University, Los Angeles - PBN
FastLineSolver Example
Push
Push
11
Chanwit Suebsureekul - California State University, Los Angeles - PBN
CompleteLineSolver
• Try all possibilities
• Look for the overlap
13
Chanwit Suebsureekul - California State University, Los Angeles - PBN
FastLineSolverVS
CompleteLineSolver
• FastLineSolver is much faster• CompleteLineSolver guarantees
the best result
14
Chanwit Suebsureekul - California State University, Los Angeles - PBN
Example
FastLineSolver CompleteLineSolver
15
Chanwit Suebsureekul - California State University, Los Angeles - PBN
Javagram Deficiency (1)
• A conflict
16
Chanwit Suebsureekul - California State University, Los Angeles - PBN
Javagram Deficiency (2)
• Multiple solutions
17
Chanwit Suebsureekul - California State University, Los Angeles - PBN
Javagram Deficiency (3)
• Not enough clue
18
Chanwit Suebsureekul - California State University, Los Angeles - PBN
Recursive Guessing
Main Program
Recursive Guessing
Javagram
Puzzle
Solution
19
Chanwit Suebsureekul - California State University, Los Angeles - PBN
Guessing Technique
• Pick a random unsolved cell• Make a guess• Continue solving puzzle
– If conflict, rollback and change the guessed cell (wrong guess)
– If not conflict, find the solution (right guess)• Still have to rollback and try another path