In this exercise, you need to translate some rules from the classic game Pac-Man into Unison functions.
You have four rules to translate, all related to the game states.
Don't worry about how the arguments are derived, just focus on combining the arguments to return the intended result.
Define the pacmanRules.eatGhost function that takes two arguments (if Pac-Man has a power pellet active and if Pac-Man is touching a ghost) and returns a boolean value if Pac-Man is able to eat the ghost. The function should return true only if Pac-Man has a power pellet active and is touching a ghost.
pacmanRules.eatGhost: Boolean -> Boolean -> Boolean
pacmanRules.eatGhost powerPelletActive touchingGhost =
todo "implement eatGhost"Define the pacmanRules.score function that takes two arguments (if Pac-Man is touching a power pellet and if Pac-Man is touching a dot) and returns a boolean value if Pac-Man scored. The function should return true if Pac-Man is touching a power pellet or a dot.
pacmanRules.score: Boolean -> Boolean -> Boolean
pacmanRules.score powerPelletActive touchingDot =
todo "implement score"Define the pacmanRules.lose function that takes two arguments (if Pac-Man has a power pellet active and if Pac-Man is touching a ghost) and returns a boolean value if Pac-Man loses. The function should return true if Pac-Man is touching a ghost and does not have a power pellet active.
pacmanRules.lose : Boolean -> Boolean -> Boolean
pacmanRules.lose powerPelletActive touchingGhost =
todo "implement lose"Define the pacmanRules.win function that takes three arguments (if Pac-Man has eaten all of the dots, if Pac-Man has a power pellet active, and if Pac-Man is touching a ghost) and returns a boolean value if Pac-Man wins. The function should return true if Pac-Man has eaten all of the dots and has not lost based on the arguments defined in part 3.
pacmanRules.win : Boolean -> Boolean -> Boolean -> Boolean
pacmanRules.win eatenAll powerPelletActive touchingGhost
todo "implement Rules.win"In this exercise, you need to translate some rules from the classic game Pac-Man into Unison functions.
You have four rules to translate, all related to the game states.
Don't worry about how the arguments are derived, just focus on combining the arguments to return the intended result.
Define the pacmanRules.eatGhost function that takes two arguments (if Pac-Man has a power pellet active and if Pac-Man is touching a ghost) and returns a boolean value if Pac-Man is able to eat the ghost. The function should return true only if Pac-Man has a power pellet active and is touching a ghost.
pacmanRules.eatGhost: Boolean -> Boolean -> Boolean
pacmanRules.eatGhost powerPelletActive touchingGhost =
todo "implement eatGhost"Define the pacmanRules.score function that takes two arguments (if Pac-Man is touching a power pellet and if Pac-Man is touching a dot) and returns a boolean value if Pac-Man scored. The function should return true if Pac-Man is touching a power pellet or a dot.
pacmanRules.score: Boolean -> Boolean -> Boolean
pacmanRules.score powerPelletActive touchingDot =
todo "implement score"Define the pacmanRules.lose function that takes two arguments (if Pac-Man has a power pellet active and if Pac-Man is touching a ghost) and returns a boolean value if Pac-Man loses. The function should return true if Pac-Man is touching a ghost and does not have a power pellet active.
pacmanRules.lose : Boolean -> Boolean -> Boolean
pacmanRules.lose powerPelletActive touchingGhost =
todo "implement lose"Define the pacmanRules.win function that takes three arguments (if Pac-Man has eaten all of the dots, if Pac-Man has a power pellet active, and if Pac-Man is touching a ghost) and returns a boolean value if Pac-Man wins. The function should return true if Pac-Man has eaten all of the dots and has not lost based on the arguments defined in part 3.
pacmanRules.win : Boolean -> Boolean -> Boolean -> Boolean
pacmanRules.win eatenAll powerPelletActive touchingGhost
todo "implement Rules.win"