in reply to Re^4: perl array matrix
in thread perl array matrix

Maybe you can then explain to us what "nearby" means? Maybe show a concrete example and explain why one set is "nearby" and another, very similar set is not "nearby"?

Just telling us "word puzzle" does not help. There are many types of word puzzles and your numbers don't explain at all how they relate to word puzzles.

Replies are listed 'Best First'.
Re^6: perl array matrix
by perlhelp (Initiate) on Apr 12, 2015 at 13:17 UTC
    nearby mean the the next search character or number is the

    neighbour of my current position of "character or number"

    example number 2 neighbour number = 1,3,5,6,7

    number 7 neighbour number = 2,3,4,6,8,10,11,12

    number 12 neighbour number = 7,8,11,3,16

    and 16 inside the 12 neighbour's numbers so "2,7,12,16" consider related each others so should return "true".

      So, it seems to be a graphical neighborhood, if I understand correctly. For example, in this matrix:
      ( [ x, x, x, x, x], [ x, y, y, y, x], [ x, y, z, y, x], [ x, y, y, y, x], [ x, x, x, x, x], )
      the "y" elements are all neighbors of "z", but the "x" elements are not. Is my understanding correct?

      But I still don't see why [2, 4, 7, 12] should pass successfully your test in your original data set:

      ( [ 1, 2, 3, 4,], [ 5, 6, 7, 8,], [ 9, 10, 11, 12,], [13, 14, 3, 16,], [ 2, 18, 19, 20,] )
      2 and 4 are not neighbors.

      Or did I miss something?

      Je suis Charlie.
        Hi; Je suis Charlie , Thanks for describe more detail on my question. But 2,4,7,12 are the chain/linkages with each other so should return true. 2 link with 7 and 7 link with 4 . something like A-star pathFinder.