added logic of the game