collect winning cells regardless to skip branch
authorDylan Lloyd <dylan@dylansserver.com>
Thu, 18 Jun 2015 00:58:52 +0000 (17:58 -0700)
committerDylan Lloyd <dylan@dylansserver.com>
Thu, 18 Jun 2015 00:58:52 +0000 (17:58 -0700)
ai.js

diff --git a/ai.js b/ai.js
index ae47f24..0bf29a5 100644 (file)
--- a/ai.js
+++ b/ai.js
@@ -151,9 +151,8 @@ $(document).ready(function(){
                 if (state[i][ii] == player)
                     tally++;
                 if (tally == size) {
-                    if (finalize)
-                        for (var iii = 0; iii < size; iii++)
-                            cells.push([i,iii]);
+                    for (var iii = 0; iii < size; iii++)
+                        cells.push([i,iii]);
                     eog = player;
                 }
             }
@@ -165,9 +164,8 @@ $(document).ready(function(){
                 if (state[ii][i] == player)
                     tally++;
                 if (tally == size) {
-                    if (finalize)
-                        for (var iii = 0; iii < size; iii++)
-                            cells.push([iii,i]);
+                    for (var iii = 0; iii < size; iii++)
+                        cells.push([iii,i]);
                     eog = player;
                 }
             }
@@ -179,9 +177,8 @@ $(document).ready(function(){
                 if (i == ii && state[i][ii] == player)
                     tally++;
                 if (tally == size) {
-                    if (finalize)
-                        for (var iii = 0; iii < size; iii++)
-                            cells.push([iii,iii]);
+                    for (var iii = 0; iii < size; iii++)
+                        cells.push([iii,iii]);
                     eog = player;
                 }
             }
@@ -195,9 +192,8 @@ $(document).ready(function(){
                     tally++;
                 if (tally == size) {
                     eog = player;
-                    if (finalize)
-                        for (var iii = 0; iii < size; iii++)
-                            cells.push([iii,(size-1)-iii]);
+                    for (var iii = 0; iii < size; iii++)
+                        cells.push([iii,(size-1)-iii]);
                     eog = player;
                 }
                 if (state[i][ii] !== 0)