Refactor game logic.

#19, #20
A working example with the possibility to play over the network.