22
Paint-By-Numbers Puzzle Chanwit Suebsureekul CS491B Spring 2006

Paint-By-Numbers Puzzle

  • Upload
    lora

  • View
    26

  • Download
    0

Embed Size (px)

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 Presentation

Citation preview

Page 1: Paint-By-Numbers Puzzle

Paint-By-Numbers Puzzle

Paint-By-Numbers Puzzle

Chanwit Suebsureekul

CS491B Spring 2006

Chanwit Suebsureekul

CS491B Spring 2006

Page 2: Paint-By-Numbers Puzzle

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

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

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

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

6

Chanwit Suebsureekul - California State University, Los Angeles - PBN

Technology

• J2SE 5.0

• Java Advanced Imaging (JAI)

• Javagram

Page 7: Paint-By-Numbers Puzzle

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

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

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

10

Chanwit Suebsureekul - California State University, Los Angeles - PBN

FastLineSolver Example

Push

Push

Page 11: Paint-By-Numbers Puzzle

11

Chanwit Suebsureekul - California State University, Los Angeles - PBN

CompleteLineSolver

• Try all possibilities

• Look for the overlap

Page 12: Paint-By-Numbers Puzzle

12

Chanwit Suebsureekul - California State University, Los Angeles - PBN

CompleteLineSolver Example

Page 13: Paint-By-Numbers Puzzle

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

14

Chanwit Suebsureekul - California State University, Los Angeles - PBN

Example

FastLineSolver CompleteLineSolver

Page 15: Paint-By-Numbers Puzzle

15

Chanwit Suebsureekul - California State University, Los Angeles - PBN

Javagram Deficiency (1)

• A conflict

Page 16: Paint-By-Numbers Puzzle

16

Chanwit Suebsureekul - California State University, Los Angeles - PBN

Javagram Deficiency (2)

• Multiple solutions

Page 17: Paint-By-Numbers Puzzle

17

Chanwit Suebsureekul - California State University, Los Angeles - PBN

Javagram Deficiency (3)

• Not enough clue

Page 18: Paint-By-Numbers Puzzle

18

Chanwit Suebsureekul - California State University, Los Angeles - PBN

Recursive Guessing

Main Program

Recursive Guessing

Javagram

Puzzle

Solution

Page 19: Paint-By-Numbers Puzzle

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

20

Chanwit Suebsureekul - California State University, Los Angeles - PBN

Why Recursive?

Page 21: Paint-By-Numbers Puzzle

21

Chanwit Suebsureekul - California State University, Los Angeles - PBN

Demo

Page 22: Paint-By-Numbers Puzzle

22

Chanwit Suebsureekul - California State University, Los Angeles - PBN

Summary

• Paint by Numbers puzzle

• JAI

• Javagram– FastLineSolver– CompleteLineSolver

• Recursive Guessing Technique