wrote some game logic