paint-by-numbers puzzle
DESCRIPTION
Paint-By-Numbers Puzzle. Chanwit Suebsureekul CS491B Spring 2006. Introduction. The black cells are hiding Find them! Use numbers as clues. The Rule. Each number represents the number of contiguous black cells, called a block There must be “ at least ” one space between blocks - PowerPoint PPT PresentationTRANSCRIPT
![Page 1: Paint-By-Numbers Puzzle](https://reader036.vdocuments.us/reader036/viewer/2022062520/56815863550346895dc5c12f/html5/thumbnails/1.jpg)
Paint-By-Numbers Puzzle
Paint-By-Numbers Puzzle
Chanwit Suebsureekul
CS491B Spring 2006
Chanwit Suebsureekul
CS491B Spring 2006
![Page 2: Paint-By-Numbers Puzzle](https://reader036.vdocuments.us/reader036/viewer/2022062520/56815863550346895dc5c12f/html5/thumbnails/2.jpg)
2
Chanwit Suebsureekul - California State University, Los Angeles - PBN
Introduction
• The black cells are hiding
• Find them!
• Use numbers as clues
![Page 3: Paint-By-Numbers Puzzle](https://reader036.vdocuments.us/reader036/viewer/2022062520/56815863550346895dc5c12f/html5/thumbnails/3.jpg)
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
![Page 4: Paint-By-Numbers Puzzle](https://reader036.vdocuments.us/reader036/viewer/2022062520/56815863550346895dc5c12f/html5/thumbnails/4.jpg)
4
Chanwit Suebsureekul - California State University, Los Angeles - PBN
Motivation
• Mario’s Picross
• Can we make the computer think
![Page 5: Paint-By-Numbers Puzzle](https://reader036.vdocuments.us/reader036/viewer/2022062520/56815863550346895dc5c12f/html5/thumbnails/5.jpg)
5
Chanwit Suebsureekul - California State University, Los Angeles - PBN
Objective
• Puzzle Solver
• Game
• Puzzle Editor– Edit by numbers– Edit by painting
![Page 6: Paint-By-Numbers Puzzle](https://reader036.vdocuments.us/reader036/viewer/2022062520/56815863550346895dc5c12f/html5/thumbnails/6.jpg)
6
Chanwit Suebsureekul - California State University, Los Angeles - PBN
Technology
• J2SE 5.0
• Java Advanced Imaging (JAI)
• Javagram
![Page 7: Paint-By-Numbers Puzzle](https://reader036.vdocuments.us/reader036/viewer/2022062520/56815863550346895dc5c12f/html5/thumbnails/7.jpg)
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
![Page 8: Paint-By-Numbers Puzzle](https://reader036.vdocuments.us/reader036/viewer/2022062520/56815863550346895dc5c12f/html5/thumbnails/8.jpg)
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
![Page 9: Paint-By-Numbers Puzzle](https://reader036.vdocuments.us/reader036/viewer/2022062520/56815863550346895dc5c12f/html5/thumbnails/9.jpg)
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
![Page 10: Paint-By-Numbers Puzzle](https://reader036.vdocuments.us/reader036/viewer/2022062520/56815863550346895dc5c12f/html5/thumbnails/10.jpg)
10
Chanwit Suebsureekul - California State University, Los Angeles - PBN
FastLineSolver Example
Push
Push
![Page 11: Paint-By-Numbers Puzzle](https://reader036.vdocuments.us/reader036/viewer/2022062520/56815863550346895dc5c12f/html5/thumbnails/11.jpg)
11
Chanwit Suebsureekul - California State University, Los Angeles - PBN
CompleteLineSolver
• Try all possibilities
• Look for the overlap
![Page 12: Paint-By-Numbers Puzzle](https://reader036.vdocuments.us/reader036/viewer/2022062520/56815863550346895dc5c12f/html5/thumbnails/12.jpg)
12
Chanwit Suebsureekul - California State University, Los Angeles - PBN
CompleteLineSolver Example
![Page 13: Paint-By-Numbers Puzzle](https://reader036.vdocuments.us/reader036/viewer/2022062520/56815863550346895dc5c12f/html5/thumbnails/13.jpg)
13
Chanwit Suebsureekul - California State University, Los Angeles - PBN
FastLineSolverVS
CompleteLineSolver
• FastLineSolver is much faster• CompleteLineSolver guarantees
the best result
![Page 14: Paint-By-Numbers Puzzle](https://reader036.vdocuments.us/reader036/viewer/2022062520/56815863550346895dc5c12f/html5/thumbnails/14.jpg)
14
Chanwit Suebsureekul - California State University, Los Angeles - PBN
Example
FastLineSolver CompleteLineSolver
![Page 15: Paint-By-Numbers Puzzle](https://reader036.vdocuments.us/reader036/viewer/2022062520/56815863550346895dc5c12f/html5/thumbnails/15.jpg)
15
Chanwit Suebsureekul - California State University, Los Angeles - PBN
Javagram Deficiency (1)
• A conflict
![Page 16: Paint-By-Numbers Puzzle](https://reader036.vdocuments.us/reader036/viewer/2022062520/56815863550346895dc5c12f/html5/thumbnails/16.jpg)
16
Chanwit Suebsureekul - California State University, Los Angeles - PBN
Javagram Deficiency (2)
• Multiple solutions
![Page 17: Paint-By-Numbers Puzzle](https://reader036.vdocuments.us/reader036/viewer/2022062520/56815863550346895dc5c12f/html5/thumbnails/17.jpg)
17
Chanwit Suebsureekul - California State University, Los Angeles - PBN
Javagram Deficiency (3)
• Not enough clue
![Page 18: Paint-By-Numbers Puzzle](https://reader036.vdocuments.us/reader036/viewer/2022062520/56815863550346895dc5c12f/html5/thumbnails/18.jpg)
18
Chanwit Suebsureekul - California State University, Los Angeles - PBN
Recursive Guessing
Main Program
Recursive Guessing
Javagram
Puzzle
Solution
![Page 19: Paint-By-Numbers Puzzle](https://reader036.vdocuments.us/reader036/viewer/2022062520/56815863550346895dc5c12f/html5/thumbnails/19.jpg)
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
![Page 20: Paint-By-Numbers Puzzle](https://reader036.vdocuments.us/reader036/viewer/2022062520/56815863550346895dc5c12f/html5/thumbnails/20.jpg)
20
Chanwit Suebsureekul - California State University, Los Angeles - PBN
Why Recursive?
![Page 21: Paint-By-Numbers Puzzle](https://reader036.vdocuments.us/reader036/viewer/2022062520/56815863550346895dc5c12f/html5/thumbnails/21.jpg)
21
Chanwit Suebsureekul - California State University, Los Angeles - PBN
Demo
![Page 22: Paint-By-Numbers Puzzle](https://reader036.vdocuments.us/reader036/viewer/2022062520/56815863550346895dc5c12f/html5/thumbnails/22.jpg)
22
Chanwit Suebsureekul - California State University, Los Angeles - PBN
Summary
• Paint by Numbers puzzle
• JAI
• Javagram– FastLineSolver– CompleteLineSolver
• Recursive Guessing Technique