Working version of gridworld.c.

This version is not ready for submission. Must be tweaked according to how
professor wants the final version submitted. Not sure if the 'helper' functions
are permitted.