I\'m doing some kind of brute force attack to solve a problem. Theoratically it is a working solution, it also really is, but it takes rather long.
I have 7 nested for l
The problem is that you are doing extra work. In your c
loop you already know that a
and b
are not equal, but you check anyway. You could exploit the flexibility of c-style for
loops:
for(var a=0;a<14;a++) {
for(var b=0;b<14 && b!=a;b++) {
for(var c=0;c<14 && c!=a && c!=b;c++) {
...
}
}
}
This gets a little verbose in the inner loop, but is at least simple.