~laumann/C

fa0d730c184fc6830467fa96b2b0f89972d59e0a — Thomas Laumann 9 years ago 31a7f41
Add lncurses
3 files changed, 7 insertions(+), 4 deletions(-)

M conway/Makefile
M conway/TODO
M conway/conway.c
M conway/Makefile => conway/Makefile +2 -1
@@ 1,11 1,12 @@
CC = gcc
CFLAGS = -Wall
LFLAGS = -lncurses
RM = rm -rvf

OBJS = conway.o

conway: $(OBJS)
	$(CC) $(CFLAGS) $(OBJS) -o $@
	$(CC) $(CFLAGS) -o $@ $< $(LFLAGS)

clean:
	@$(RM) $(OBJS) conway *~

M conway/TODO => conway/TODO +1 -1
@@ 2,7 2,6 @@ TODO:
	- Allow options --rows=<int>, --cols=<int> to indicate the size of the
	  world.
	- Create ncurses display.
	- Allow option --interval=<int> that sets the interval times.
	- Optimisation: Eliminate if's in calculating the sum... rather have
	  several for loops that each know what to do (without asking
	  questions).


@@ 27,5 26,6 @@ TODO:
	  0 0 1 1

DONE:
	- Allow option --interval=<int> that sets the interval times.
	- for every "timeslice", initialise a new array and fill it based on the
	  values of the old array, then replace the old array.

M conway/conway.c => conway/conway.c +4 -2
@@ 105,9 105,11 @@ conway_timeslice(int **current, int **new, int rows, int cols)
}

const char conway_usage[] = "Usage: ./conway [options]\n\n"
	" Conway's Game of Life.\n\n"
	"Common options:\n"
	" -h,--help                  Print help information and exit.\n"
	" -i,--interval <millisecs>  Set the update interval.\n";
	" -h, --help              Print help information and exit.\n"
	" -i, --interval <msecs>  Set the update interval.\n"
	" -f, --file <file>       Set in input file.\n";

void
handle_cmd_args(int *argc, const char ***argv)