Game logic and unit tests