Remove duplicated code and fix a memory leak.

Before, we would allocate a new board and potentially just throw the
pointer away, if the move had already been played. By moving the
allocation into the add_child function, we avoid duplicated code for
performing the move, and eliminate the memory leak.
Simplify free_game() for the (relatively) new Game structure
Lots of misc. refactoring/tidying up.