Ok, consider the following:
I have a large array containing arrays, -1, aand b.
-1 means the field is empty:
var board = [
[-1,-1, a],
[-1,-1, b],
[ b,-1, a]
]
Now I want to check smaller arrays again:
var solutions = [
[
[1, 1, 1]
],
[
[1],
[1],
[1]
],
[
[1],
[0,1],
[0,0,1]
],
[
[0,0,1],
[0,1],
[1]
]
]
To find out if an existing value from boardpattern in matches solutions.
Does it match aany pattern?
Does it match bany pattern?
Can any of you see a better way than doing a crazy nested loop:
var q,w,e,r,t,y;
q=w=e=r=t=y=0;
for( ; q < 3; q++ ) {
for( ; w < 3; w++ ) {
for( ; e < SOLUTIONS.length; e++ ) {
.... and so on...
}
}
}
In this example, I used tic-tac-toe.
But I could be anything.