aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEmil Williams2024-07-24 20:18:50 +0000
committerEmil Williams2024-07-24 20:18:50 +0000
commit55c146c9276b4727adcc55e75a4304bf94f08f96 (patch)
tree51d779c69bc354a47325d376d7b1914f65225336
parent947ff4e7658442cbb48215422c108742a7cdceab (diff)
downloademil-life-55c146c9276b4727adcc55e75a4304bf94f08f96.tar.xz
emil-life-55c146c9276b4727adcc55e75a4304bf94f08f96.tar.zst
fully disable debug compilation, remove code comments
-rw-r--r--life.c82
1 files changed, 1 insertions, 81 deletions
diff --git a/life.c b/life.c
index 8bc9ea0..eb84346 100644
--- a/life.c
+++ b/life.c
@@ -1,5 +1,5 @@
/* @BAKE \
- cc -O2 -Wshadow -Wall -Wextra -Wpedantic -g -fsanitize=address,undefined,bounds \
+ cc -O2 -Wshadow -Wall -Wextra -Wpedantic \
$@ -o $* -lm -DNDEBUG $+ @STOP */
#include <math.h>
@@ -110,26 +110,6 @@ DELC board_t * board_dup (board_t * b) {
return a;
}
-#if 0
-DELC int board_cmp (board_t * a, board_t * b) {
- int s = 0;
- for (int i = 0; i < b->h; ++i) {
- for (int f = 0; f < b->w; ++f) {
- s += a->g [i] [f] != b->g [i] [f];
- }
- }
- return s;
-}
-
-DELC void board_invert (board_t * b) {
- for (int i = 0; i < b->h; ++i) {
- for (int f = 0; f < b->w; ++f) {
- b->g [i] [f] = !(b->g [i] [f] == 1);
- }
- }
-}
-#endif
-
/* Must place the cursor at the top left of the already printed board */
DELC void board_highlight (board_t * b, int fg, int x, int y) {
if (y) { move_down (y); }
@@ -158,49 +138,6 @@ DELC board_t * board_alloc_text (char * s) {
/* life */
-#if 0
-DELC int life_near_loop (board_t * b, int x, int y) {
- int ** g = b->g, w = b->w, h = b->h;
-
- int
- ty = (y-1) % h, lx = (x-1) % w,
- cy = ( y) % h, cx = ( x) % w,
- by = (y+1) % h, rx = (x+1) % w;
-
- return
- g [ty] [lx] + g [ty] [cx] + g [ty] [rx]
- + g [cy] [lx] + (g [cy] [cx] << 5) + g [cy] [rx]
- + g [by] [lx] + g [by] [cx] + g [by] [rx];
-}
-
-DELC int life_near_lim (board_t * b, int x, int y) {
- int ** g = b->g, w = b->w, h = b->h;
-
- int
- ty = (y-1), lx = (x-1),
- cy = ( y), cx = ( x),
- by = (y+1), rx = (x+1),
- s = g [cy] [cx] << 5;
-
- if (ty < h) {
- s += lx < w ? g [ty] [lx] : 0;
- s += g [ty] [cx] ;
- s += rx >= 0 ? g [ty] [rx] : 0;
- }
-
- s += lx < w ? g [cy] [lx] : 0;
- s += rx >= 0 ? g [cy] [rx] : 0;
-
- if (by >= 0) {
- s += lx < w ? g [by] [lx] : 0;
- s += g [by] [cx] ;
- s += rx >= 0 ? g [by] [rx] : 0;
- }
-
- return s;
-}
-#endif
-
DELC int life_near_lim (board_t * b, int x, int y) {
int ** g = b->g, w = b->w, h = b->h, s = 0, i, f, yi, xf;
for (i = -1; i < 2; ++i) {
@@ -239,23 +176,6 @@ DELC void life_update (board_t * a, board_t * b) {
}
}
-#if 0
-DELC void life_update (board_t * a, board_t * b) {
- int near, me, ** g = a->g;
- for (int i = 0; i < b->h; ++i) {
- for (int f = 0; f < b->w; ++f) {
- near = life_near (b, f, i);
- me = near & LIFE_ALIVE;
- near &= LIFE_NEAR_MASK;
- g [i] [f] =
- (near == 3)
- + ( (me && (near < 2))
- || (me && (near > 3))) * LIFE_DEAD;
- }
- }
-}
-#endif
-
DELC void life (board_t * b, int step, int wait) {
printf (
"rect %d:%d\n"