Most in need of whitespace

Joshua Karns
Twitter: @jkarnss

Judges' comments:

To use:

make

./prog < textfile_that_fits_on_the_screen

Try:

make test

./prog < hint.text

Selected Judges Remarks:

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!

Before running, make sure that your terminal can accommodate the whole file. Before running “make test”, make it about 120x40 to be safe, ensuring that you see the @ sign as well as the exclamation mark.

…Oh, and the first M in YMMV stands for “mazing”.

A puzzle for the reader: Can you change the program to consider a diagonal movement as one step?

Author’s comments:

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’ character, which is going to be the starting location, and a ‘!’ character 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

This program usually compiles under both GCC and clang. Build with:

$(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

Examples: ./tbfs < maze ./tbfs < prog.c

Issues


Creative Commons License

© Copyright 1984-2019, Leo Broukhis, Simon Cooper, Landon Curt Noll - All rights reserved
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.