From fa0d730c184fc6830467fa96b2b0f89972d59e0a Mon Sep 17 00:00:00 2001 From: Thomas Laumann Date: Tue, 20 Dec 2011 22:06:25 +0100 Subject: [PATCH] Add lncurses --- conway/Makefile | 3 ++- conway/TODO | 2 +- conway/conway.c | 6 ++++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/conway/Makefile b/conway/Makefile index f2d0a14..43c4e9a 100644 --- a/conway/Makefile +++ b/conway/Makefile @@ -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 *~ diff --git a/conway/TODO b/conway/TODO index 12a91a8..4355723 100644 --- a/conway/TODO +++ b/conway/TODO @@ -2,7 +2,6 @@ TODO: - Allow options --rows=, --cols= to indicate the size of the world. - Create ncurses display. - - Allow option --interval= 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= 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. diff --git a/conway/conway.c b/conway/conway.c index b6b8c26..eb7645b 100644 --- a/conway/conway.c +++ b/conway/conway.c @@ -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 Set the update interval.\n"; + " -h, --help Print help information and exit.\n" + " -i, --interval Set the update interval.\n" + " -f, --file Set in input file.\n"; void handle_cmd_args(int *argc, const char ***argv) -- 2.45.2