Move game logic into a class.