principal game logic implemented