implemented game logic