home
/
code
/
cellular-automata.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
c3a63cc
)
Removed unnecessary call to length().
author
Siraaj Khandkar
<siraaj@khandkar.net>
Tue, 28 Aug 2012 16:21:46 +0000
(12:21 -0400)
committer
Siraaj 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
patch
|
blob
|
blame
|
history
diff --git
a/005/life.awk
b/005/life.awk
index
3c9c7d7
..
101f66a
100755
(executable)
--- 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];
This page took
0.029186 seconds
and
4
git commands to generate.