From 443ef34752734dfb68f7609075182f7d76c125bc Mon Sep 17 00:00:00 2001 From: Siraaj Khandkar Date: Tue, 28 Aug 2012 12:21:46 -0400 Subject: [PATCH] Removed unnecessary call to length(). Also, length isn't supported in mawk :( --- 005/life.awk | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/005/life.awk b/005/life.awk index 3c9c7d7..101f66a 100755 --- a/005/life.awk +++ b/005/life.awk @@ -59,7 +59,7 @@ function get_new_state(state, live_neighbors) { function set_generation(board, gen_id, y, x) { - split("N,NE,E,SE,S,SW,W,NW", directions, ","); + num_directions = split("N,NE,E,SE,S,SW,W,NW", directions, ","); offsets["N" , "x"] = 0; offsets["N" , "y"] = -1; @@ -95,8 +95,6 @@ function set_generation(board, gen_id, y, x) { state = board[prev_gen_id, yi, xi]; live_neighbors = 0; - num_directions = length(directions); - for (dir_i=1; dir_i <= num_directions; dir_i ++) { direction = directions[dir_i]; -- 2.20.1