From: Dylan Lloyd Date: Thu, 18 Jun 2015 00:58:52 +0000 (-0700) Subject: collect winning cells regardless to skip branch X-Git-Url: https://disinclined.org/git/?a=commitdiff_plain;h=d0013158a877f37735f93ced64bb11a558f6162e;p=minimax.git collect winning cells regardless to skip branch --- diff --git a/ai.js b/ai.js index ae47f24..0bf29a5 100644 --- 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)