From: Siraaj Khandkar Date: Tue, 28 Aug 2012 16:21:46 +0000 (-0400) Subject: Removed unnecessary call to length(). X-Git-Url: https://git.xandkar.net/?a=commitdiff_plain;h=443ef34752734dfb68f7609075182f7d76c125bc;p=cellular-automata.git Removed unnecessary call to length(). Also, length isn't supported in mawk :( --- 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];