aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAiden Woodruff <aiden.woodruff@gmail.com>2018-07-27 19:49:52 -0500
committerAiden Woodruff <aiden.woodruff@gmail.com>2018-07-27 19:49:52 -0500
commit9d7bc4b73663b7819f1768879b6ec8f72ea89dad (patch)
treeae1b4953fed1348c3ba2b4ac4235cca325635723
parentf444df8fa0ed3feca1c3766b53ec0ee753dd15d5 (diff)
downloadlife-9d7bc4b73663b7819f1768879b6ec8f72ea89dad.tar.gz
life-9d7bc4b73663b7819f1768879b6ec8f72ea89dad.tar.bz2
life-9d7bc4b73663b7819f1768879b6ec8f72ea89dad.zip
Add command line options to change cell characterslife-1.1.0
Change dead cells with '-D' Change live cells with '-L' Signed-off-by: Aiden Woodruff <aiden.woodruff@gmail.com>
-rw-r--r--life.c16
-rw-r--r--life.ggo2
2 files changed, 18 insertions, 0 deletions
diff --git a/life.c b/life.c
index c0afbb3..12df2f2 100644
--- a/life.c
+++ b/life.c
@@ -41,6 +41,22 @@ int main (int argc, char * argv[]) {
41 if (args_info.width_given) width = args_info.width_arg; 41 if (args_info.width_given) width = args_info.width_arg;
42 if (args_info.height_given) height = args_info.height_arg; 42 if (args_info.height_given) height = args_info.height_arg;
43 if (args_info.delay_given) delaymax = args_info.delay_arg; 43 if (args_info.delay_given) delaymax = args_info.delay_arg;
44 if (args_info.live_given) {
45 if (strlen(args_info.live_arg) > 1) {
46 fprintf(stderr, "Live character must be one character long");
47 exit(EXIT_FAILURE);
48 } else {
49 livecell = (int) args_info.live_arg[0];
50 }
51 }
52 if (args_info.dead_given) {
53 if (strlen(args_info.dead_arg) > 1) {
54 fprintf(stderr, "Dead character must be one character long");
55 exit(EXIT_FAILURE);
56 } else {
57 deadcell = (int) args_info.dead_arg[0];
58 }
59 }
44 cmdline_parser_free(&args_info); 60 cmdline_parser_free(&args_info);
45 char * map = NULL; 61 char * map = NULL;
46 map = malloc((height * width)+1); 62 map = malloc((height * width)+1);
diff --git a/life.ggo b/life.ggo
index ffc59ed..1622a55 100644
--- a/life.ggo
+++ b/life.ggo
@@ -3,3 +3,5 @@ option "ruleint" r "Specify rule-int on command line" typestr="rule" default="61
3option "width" W "Specify width" typestr="width" int optional 3option "width" W "Specify width" typestr="width" int optional
4option "height" H "Specify height" typestr="height" int optional 4option "height" H "Specify height" typestr="height" int optional
5option "delay" d "Specify delay time" details="Specify delay time, multiplied by 10ms" typestr="delay" int optional 5option "delay" d "Specify delay time" details="Specify delay time, multiplied by 10ms" typestr="delay" int optional
6option "live" L "Character for a live cell" typestr="live" string optional
7option "dead" D "Character for a dead cell" typestr="dead" string optional