Removed unnecessary call to length().
authorSiraaj Khandkar <siraaj@khandkar.net>
Tue, 28 Aug 2012 16:21:46 +0000 (12:21 -0400)
committerSiraaj Khandkar <siraaj@khandkar.net>
Tue, 28 Aug 2012 16:21:46 +0000 (12:21 -0400)
Also, length isn't supported in mawk :(

005/life.awk

index 3c9c7d7..101f66a 100755 (executable)
@@ -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];
 
This page took 0.017402 seconds and 4 git commands to generate.