diff --git a/main b/main index 7001d57..b840393 100755 Binary files a/main and b/main differ diff --git a/main.c b/main.c index 052ca2e..f504b2f 100644 --- a/main.c +++ b/main.c @@ -12,10 +12,12 @@ #include +#include + uint16_t Hole_Div = 40; uint16_t SCR_X; uint16_t SCR_Y; -#define FPS (60) +uint16_t FPS = 60; char blank_char = 32; char wall_char = 35; char goal_char = 71; @@ -26,6 +28,7 @@ uint16_t wall_color = 1; uint16_t goal_color = 2; uint16_t player_color = 3; uint16_t border_color = 4; +uint16_t Quit_on_pass = 0; char letter = ' '; struct Object { uint16_t x; @@ -236,9 +239,26 @@ int main(int argc, char * argv[]) { SCR_Y = atoi(argv[2]); Hole_Div = atoi(argv[3]); } + if(argc == 5){ + SCR_X = atoi(argv[1]); + SCR_Y = atoi(argv[2]); + Hole_Div = atoi(argv[3]); + FPS = atoi(argv[4]); + } + if (argc == 6){ + SCR_X = atoi(argv[1]); + SCR_Y = atoi(argv[2]); + Hole_Div = atoi(argv[3]); + FPS = atoi(argv[4]); + if(strcmp(argv[5],"-n") == 0){ + Quit_on_pass = 1; + } + } generate_maze(); - render_maze(); - draw_maze(); + if(Quit_on_pass == 0){ + render_maze(); + draw_maze(); + } while (1) { inputs_tmp = keyinput(); if (inputs_tmp == 1) { @@ -250,10 +270,15 @@ int main(int argc, char * argv[]) { } else { orient = 0; } + if(Quit_on_pass == 1){ + return 4; + } generate_maze(); } - render_maze(); - draw_maze(); + if(Quit_on_pass == 0){ + render_maze(); + draw_maze(); + } usleep(round(1000000 / FPS)); } endwin(); diff --git a/test.sh b/test.sh new file mode 100644 index 0000000..e559bf3 --- /dev/null +++ b/test.sh @@ -0,0 +1,28 @@ +#!/bin/bash +RANDOM=$$$(date +%s) +X="" +CNT=0 +CNTX=0 +CNTA=0 +CNTB=0 +CNTXB=0 +CNTAB=0 +while [ $CNTX -lt 50 ]; do + let CNT=0 + + while [ $CNT -lt 162 ]; do + X+="wd" + let CNT=CNT+1 + done + + let CNTA=0 + + while [ $CNTA -lt 162 ]; do + X+="wa" + let CNTA=CNTA+1 + done + let CNTX=CNTX+1 +done + +X+="q" +echo $X \ No newline at end of file