Implemented the rules for the game.