From 8b000505cb73d0ce5ad3d0e527143befb23c8e41 Mon Sep 17 00:00:00 2001 From: Preston Pan Date: Mon, 6 Feb 2023 13:48:14 -0800 Subject: documentation change --- doc/snake3.1 | 7 +++++-- snake.c | 5 ++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/doc/snake3.1 b/doc/snake3.1 index 961c4eb..d8d8235 100644 --- a/doc/snake3.1 +++ b/doc/snake3.1 @@ -3,7 +3,7 @@ snake3 \- small command line snake program .SH SYNOPSIS -\fBsnake3\fP [--version] [--help] +\fBsnake3\fP [--version] [--help] [--size board_size] [--speed speed] .SH DESCRIPTION You control a snake, and the objective is to grow as long as possible. @@ -17,7 +17,10 @@ keys to navigate. The game becomes faster as you grow. \fB--help\fP \-\- Displays the usage information for the snake3 program. - +\fB--size\fP +\-\- Sets the board size - the board is a square so only one number is taken as an input +\fB--speed\fP +\-\- Sets the speed of the snake - up to 10. .SH AUTHORS Developed and maintained by Kai Stevenson, with features added by Preston Pan. diff --git a/snake.c b/snake.c index a46e0eb..d273935 100644 --- a/snake.c +++ b/snake.c @@ -44,7 +44,7 @@ int main(int argc, char **argv) { return 0; } else if(strcmp("--help", argv[i]) == 0) { - printf("usage: snake3 [--version] [--help]\n"); + printf("usage: snake3 [--version] [--help] [--size board_size] [--speed speed]\n"); return 0; } else if (strcmp("--size", argv[i]) == 0 || strcmp("--speed", argv[i]) == 0) { @@ -64,6 +64,9 @@ int main(int argc, char **argv) { if (speed <= 0) { fprintf(stderr, "%sspeed level must be greater than zero and integer. Please try again.%s\n", RED, COLOR_RESET); exit(1); + } if (speed > 10) { + fprintf(stderr, "%sspeed must not be greater than ten. Please try again.%s\n", RED, COLOR_RESET); + exit(1); } } was_flag = 0; -- cgit v1.3.1