Work on integrating Terry's algorithm with the app

It doesn't actually do anything yet, but it should be targeting the right
struct and it all builds with G++ now (the algorithm used a few C++ features).

Made sure to initialize cells to a consistent state, cleaned out a few things
such as unused *next and *prev in Grid, unused lbutton and rbutton mouse flags,
used bools where it makes sense since we're using C++ now, killed some trailing
whitespace.