From 15531b6ebd0ecf1eb528eb5df019a05acc11eb27 Mon Sep 17 00:00:00 2001 From: Jeremy Fan Date: Wed, 6 May 2015 14:03:23 +0800 Subject: [PATCH] maybe a bug-fix exercise18.3 --- code/solutions/18_3_conways_game_of_life.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/solutions/18_3_conways_game_of_life.html b/code/solutions/18_3_conways_game_of_life.html index c035ca762..b5f00c481 100644 --- a/code/solutions/18_3_conways_game_of_life.html +++ b/code/solutions/18_3_conways_game_of_life.html @@ -44,7 +44,7 @@ var count = 0; for (var y1 = Math.max(0, y - 1); y1 <= Math.min(height, y + 1); y1++) { for (var x1 = Math.max(0, x - 1); x1 <= Math.min(width, x + 1); x1++) { - if ((x1 != x || y1 != y) && grid[x1 + y1 * width]) + if ((x1 != x || y1 != y) && grid[x1 + y1 * width] && x1!=width) count +=1 ; } }