diff --git a/2019/karns/Makefile b/2019/karns/Makefile index 2fff37395..f3297bdbe 100644 --- a/2019/karns/Makefile +++ b/2019/karns/Makefile @@ -104,8 +104,8 @@ CINCLUDE= #CINCLUDE= -include stdlib.h #CINCLUDE= -include stdio.h #CINCLUDE= -include stdlib.h -include stdio.h -#CINCLUDE= -I ${X11_INCDIR} -#CINCLUDE= -I ${HOMEBREW_PREFIX}/include/SDL2 +#CINCLUDE= -I ${X11_INCDIR} -I ${X11_INCDIR}/X11 +#CINCLUDE= `${SDL2_CONFIG} --cflags` # Optimization # @@ -129,7 +129,7 @@ CFLAGS= ${CSTD} ${CWARN} ${ARCH} ${CDEFINE} ${CINCLUDE} ${OPT} LIBS= #LIBS= -lm #LIBS= -L ${X11_LIBDIR} -lX11 -#LIBS= -L ${HOMEBREW_PREFIX}/lib -lSDL +#LIBS= `${SDL2_CONFIG} --libs` # C compiler to use # @@ -168,7 +168,8 @@ ENTRY= karns PROG= prog # OBJ= ${PROG}.o -DATA= +CSRC= ${PROG}.o +DATA= maze demo.sh TARGET= ${PROG} # ALT_OBJ= @@ -189,9 +190,6 @@ all: data ${TARGET} ${PROG}: ${PROG}.c ${CC} ${CFLAGS} $< -o $@ ${LIBS} -test: ${PROG} - ${CAT} ${PROG}.c | ./${PROG} - # alternative executable # alt: data ${ALT_TARGET} diff --git a/2019/karns/README.md b/2019/karns/README.md index 82652b4cf..497d5478d 100644 --- a/2019/karns/README.md +++ b/2019/karns/README.md @@ -1,33 +1,38 @@ # Most in need of whitespace -Joshua Karns -Twitter: @jkarnss + Joshua Karns + Twitter: @jkarnss -## To build: +# To build: - make all +```sh +make +``` -### To run +### To run: - ./prog < textfile_that_fits_on_the_screen +```sh +./prog < textfile_that_fits_on_the_screen +``` ### Try: - make test +```sh +./prog < README.md - ./prog < README.md +./prog < prog.c - ./prog < prog.c - - ./prog < maze +./prog < maze +``` The last two can be done in a sequence, first showing the respective files at the terminal, like: - ./demo.sh +```sh +./demo.sh +``` - -### Selected Judges Remarks: +## Judges' comments: If you typically get lost in mazes, watching this program run might -- or might not, YMMV -- teach you how to find your way in a maze. The algorithm is well-known but the drawing is amazing! @@ -41,8 +46,7 @@ A puzzle for the reader: Can you change the program to consider a diagonal movem ## Author's comments: -The Program ------------ +### The Program This program is pretty simple! It performs a breadth first search on the specified graph. The graph can be any ascii text file that has an 'at' @@ -52,26 +56,31 @@ which will be the destination. The nodes on this graph that are spaces are connected with any directly adjacent nodes that are also spaces. Nodes that aren't spaces are not connected with anything. - -Compiling and Running ---------------------- +### Compiling and Running This program usually compiles under both GCC and clang. Build with: - $(CC) -std=c99 -o tbfs prog.c +```sh +$(CC) -std=c99 -o tbfs prog.c +``` where $(CC) is cc, gcc, clang, or somet other c compiler. You can then run it with: - cat | ./tbfs + +```sh +cat | ./tbfs +``` Examples: - ./tbfs < maze - ./tbfs < prog.c -Issues ------------ +```sh +./tbfs < maze +./tbfs < prog.c +``` + +### Issues - The program must be ran in a terminal that supports ANSI escape codes for moving the cursor and changing colors. @@ -88,11 +97,10 @@ not encountered this myself). - The program could be obfuscated much further. - The program contains some unused code and data. --------------------------------------------------------------------------------- -