Refactored significantly in preparation for a title screen; separated
game logic from setup and management, and moved utility functions to
their own file.