Refactor the game

Mostly reorganise the_game() to make it more ... approachable, maintainable, readable.