Content uploaded by Khatatneh Khalaf
Author content
All content in this area was uploaded by Khatatneh Khalaf on May 18, 2016
Content may be subject to copyright.
New Technique To Solve Nonogram Puzzle Problem With
Quake Algorithm
Khalaf Khatatneh1
Information Technology Department Al-Balqa Applied University Al-Salt, Jordan
Key-Words: N-Puzzle, shortest path problem
,Dijkstra algorithm, Automata with
Multiplicities.
Abstract
Nonograms are logic puzzles in which squares in
a grid are colored or left blank according to
numbers given at the side of the grid where the
cell is filled (black) or empty (white) which in
that case called space. Once completed, the
puzzle reveals a hidden picture. Nonograms may
be black and white or colored, in which case the
number clues are also colored to show the color
of the squares. Nonograms can be of any size or
shape ,also there is a different kind of nongram-
called triddlers- in which cells are triangles. in
this kind of puzzles we have three sets of clues
instead only of two. and it vary in difficulty of
the levels. The general Nonogram problem is
NP-hard.
This paper will enhance a new algorithm for
solving nonogram puzzle problem depend on
genetic algorithm and particles swarm algorithms
to solve square nanogram puzzle.
Introduction
Nonogram is a Japanese puzzle which takes the
form of a N ×M matrix, with numbers located on
the left that represent the number of filled cells in
each row and the numbers on the top represent
the filled cells in the columns.
In this puzzle the numbers represent how many
cells which are filled or empty in a certain row,
for example the numbers 1,3,4 means that there
is 1 ,3,4 consecutive groups of black cell but
separated with at least one space between the
groups .the problem in this puzzle is to know
how these consecutive groups are ordered.
These puzzles originated in Japan, and have a
variety of names such as picture puzzles,
painting by numbers and Japanese crosswords .
The puzzler gradually makes a drawing on a
grid, by means of logical reasoning. This task
can be imitated by using techniques from
Artificial Intelligence. it can be represented in a
tow dimensional array with a specified number
of columns and rows. In Figure.1(a) a simple
example of nonogram puzzle and figure.1(b) the
correct solution for the puzzle.
Figure 1: a) nonogram Puzzle
b) the solution of (a)
For solving nongram puzzle at first we should
find the sum of 1's in each row and column in
this array and take the absolute value for the
deference between this row or column with
Nanogram , secondly add this differences to each
other if the result equal zero (0) then this
solution is optimal for
problem.
Particle swarm (birds when search food)
Like a bird swarm went to search food, all
particles work to each other to find food , this
technique solving Nanogram problem by
continuous search in 2-D array and shift all rows
to the right to satisfy the condition that the
deference between Nanogram is zero .
JOURNAL OF COMPUTING, VOLUME 3, ISSUE 12, DECEMBER 2011, ISSN 2151-9617
https://sites.google.com/site/journalofcomputing
WWW.JOURNALOFCOMPUTING.ORG
169
In this paper will chose the random 2-D arrays
throw (applying) the condition that any 2-D array
and nonogram will have deference between rows
is equal zero.
Figure 2: solving Nanogram using Particle swarm
Figure 3: example for Particle swarm down
Population problem, when 2-D array
have invalid column(s):
2-D array will chosen randomly depend on
deference between rows will be zero ,the
traditional particle swarm will can't solve this
Nanogram problem.
Here we need to make leap to build new
generation using genetic algorithm (GA),and
particle swarm algorithm.
Choose row that try to make same sequence for
nonogram and 2-D array column using genetic
Mutation then applying particle swarm
algorithm.
Minimal number of probability for
genetic algorithm to make mutation
Figure 4: Minimal number probability for
genetic mutation
As the Figure 4 shown the black arrows have
deferent value for column that have maximum
Priority to make leap using cross over.
Testing
This algorithm run over 90 square Nanogram
puzzle (3*3,4*4,5*5), succeed to solve it all with
complexity equal O (n3).
Figure 5: genetic
i
JOURNAL OF COMPUTING, VOLUME 3, ISSUE 12, DECEMBER 2011, ISSN 2151-9617
https://sites.google.com/site/journalofcomputing
WWW.JOURNALOFCOMPUTING.ORG
170
Conclusion
This algorithm depends on two co-factors the
first one is population size that will give us more
probability to find optimal solution when
maximized it ,and second factor is Nanogram
size ,if Nanogram size is big the algorithm will
take more time to find optimal solution there for
should algorithm after number of generation if
we don't find optimal solution.
References:
Batenburg KJ, KostersWA ,”A discrete
tomography approach to Japanese puzzles.” ,In
Proceedings of BNAIC, pp 243–250,Oct 2004.
K.J. Batenburg and W.A. Kosters ,”Solving
Nonograms by combining relaxations.”,
Pattern Recognition 42, 2009.
K.J. Batenburg, S. Henstra, W.A. Kosters and
W.J. Palenstijn, “Constructing Simple
Nonograms of Varying Difficulty”, Pure
Mathematics and Applications, 2009.
Young-Sun Sohn, Kabsuk Oh and Bo-Sung
Kim ,”A Recognition Method of the Printed
Alphabet By using Nonogram Puzzle”,2007.
Wiggers WA , “A comparison of a genetic
algorithm and a depth first search algorithm
applied to Japanese nonograms”. Twente
student conference on IT, Jun 2004.
JOURNAL OF COMPUTING, VOLUME 3, ISSUE 12, DECEMBER 2011, ISSN 2151-9617
https://sites.google.com/site/journalofcomputing
WWW.JOURNALOFCOMPUTING.ORG
171