You are in the process of developing the new highly appreciated game Crystal Hunter. In the game, you are a character who moves around and collects crystals. The player wins by picking up all the crystals. If the player comes in contact with a bandit, they will lose all their crystals and the game. There is an exception to this rule: the player can have an active power-up that makes them invisible to the bandits.
Your goal is to write some rules that will be used in the game.
In the game, the character will get bonus points if they touch a bandit while having a power-up.
Define the Rules#bonus_points? method that takes two arguments (if the character has an active power-up and if the character is touching a bandit) and returns a boolean value that tells whether the character will get bonus points.
The method should return true only if the character has a power-up active and is touching a bandit and false otherwise.
Rules.new.bonus_points?(false, true)
# => falseThe player gets points in the game when picking up a crystal or a power-up.
Define the Rules#score? method, which takes two arguments (if the character is touching a power-up and if the character is touching a crystal) and returns a boolean value indicating whether the character scored or not.
The method should return true if the character touches a power-up or a crystal and return false otherwise.
Rules.new.score?(true, true)
# => trueDefine the Rules#lose? method, which takes two arguments (if the character has a power-up active and if the character is touching a bandit) and returns a boolean value that indicates whether the character loses or not.
The method should return true if the character touches a bandit and does not have a power-up active and return false otherwise.
Rules.new.lose?(false, true)
# => trueDefine the Rules#win? method, which takes three arguments (if the character has picked up all of the crystals, if the character has a power-up active, and if the character is touching a bandit) and returns a boolean value indicating whether the character wins or not.
The method should return true if the character has gathered all crystals and has not lost based on the arguments defined in part 3 and return false otherwise.
Rules.new.win?(false, true, false)
# => falseYou are in the process of developing the new highly appreciated game Crystal Hunter. In the game, you are a character who moves around and collects crystals. The player wins by picking up all the crystals. If the player comes in contact with a bandit, they will lose all their crystals and the game. There is an exception to this rule: the player can have an active power-up that makes them invisible to the bandits.
Your goal is to write some rules that will be used in the game.
In the game, the character will get bonus points if they touch a bandit while having a power-up.
Define the Rules#bonus_points? method that takes two arguments (if the character has an active power-up and if the character is touching a bandit) and returns a boolean value that tells whether the character will get bonus points.
The method should return true only if the character has a power-up active and is touching a bandit and false otherwise.
Rules.new.bonus_points?(false, true)
# => falseThe player gets points in the game when picking up a crystal or a power-up.
Define the Rules#score? method, which takes two arguments (if the character is touching a power-up and if the character is touching a crystal) and returns a boolean value indicating whether the character scored or not.
The method should return true if the character touches a power-up or a crystal and return false otherwise.
Rules.new.score?(true, true)
# => trueDefine the Rules#lose? method, which takes two arguments (if the character has a power-up active and if the character is touching a bandit) and returns a boolean value that indicates whether the character loses or not.
The method should return true if the character touches a bandit and does not have a power-up active and return false otherwise.
Rules.new.lose?(false, true)
# => trueDefine the Rules#win? method, which takes three arguments (if the character has picked up all of the crystals, if the character has a power-up active, and if the character is touching a bandit) and returns a boolean value indicating whether the character wins or not.
The method should return true if the character has gathered all crystals and has not lost based on the arguments defined in part 3 and return false otherwise.
Rules.new.win?(false, true, false)
# => false