Modify of algorithm.

Example didn't have a guard against empty locations. Removed mine for consistency. Swapped out xy based double loop. Seemed more readable than manipulating a single counter. Also removed '/' and '%' operations in favor of a counter.