Quantcast
Channel: Adobe Community : Popular Discussions - InDesign Scripting
Viewing all articles
Browse latest Browse all 15932

math / array / matrix-question

$
0
0

Hallo everybody,

 

first of all: it's not a indesignscripting-  but general math-javascriptquestion. please be patient

 

I've got a first (matrixlike-)array (won't change)

 

var containers = [
'container11', 'container12', 'container13', 'container14', 'container15',
'container21', 'container22', 'container23', 'container24', 'container25',
'container31', 'container32', 'container33', 'container34', 'container35',
'container41', 'container42', 'container43', 'container44', 'container45',
'container51', 'container52', 'container53', 'container54', 'container55'
];

and I've got a second array:

 

["container14", "container25", "container34", "container44", "container54"] //this array may contain 3 up to 8 items

 

My aim is to check if a part of 5 to 3 items of the second array is part of or equal to a row or column of the matrix-like-array.

 

For example: "container34", "container44", "container54" or "container11", "container12", "container13", "container14" (as part of second array) would be a result I#m looking for. Note: I only want to find the 'biggest charge'!

 

Hope it's getting clear and one of the math-cracks will have a idea.

 

Addittional: there's no MUST to work with arrays. I can also store the data to a object or mixture ... and may fill it with numbers instead of strings ...

 

To get it visible:

https://dl.dropboxusercontent.com/spa/3ftsuc9opmid3j4/Exports/fourWins /fourWins.html

Items can be dragged and dropped. After every dropp the arrays have to be compared ... and I#m searching for a nice and elegant solution

 

May be someone's interested

 

Hans


Viewing all articles
Browse latest Browse all 15932