"""Functions for implementing the rules of the classic arcade game Pac-Man."""defeat_ghost(power_pellet_active:bool,touching_ghost:bool):"""Verify that Pac-Man can eat a ghost if he is empowered by a power pellet.
:param power_pellet_active: bool - does the player have an active power pellet?
:param touching_ghost: bool - is the player touching a ghost?
:return: bool - can the ghost be eaten?
"""returnpower_pellet_activeandtouching_ghostdefscore(touching_power_pellet,touching_dot):"""Verify that Pac-Man has scored when a power pellet or dot has been eaten.
:param touching_power_pellet: bool - is the player touching a power pellet?
:param touching_dot: bool - is the player touching a dot?
:return: bool - has the player scored or not?
"""returntouching_dotortouching_power_pelletdeflose(power_pellet_active,touching_ghost):"""Trigger the game loop to end (GAME OVER) when Pac-Man touches a ghost without his power pellet.
:param power_pellet_active: bool - does the player have an active power pellet?
:param touching_ghost: bool - is the player touching a ghost?
:return: bool - has the player lost the game?
"""returntouching_ghostandnotpower_pellet_activedefwin(has_eaten_all_dots,power_pellet_active,touching_ghost):"""Trigger the victory event when all dots have been eaten.
:param has_eaten_all_dots: bool - has the player "eaten" all the dots?
:param power_pellet_active: bool - does the player have an active power pellet?
:param touching_ghost: bool - is the player touching a ghost?
:return: bool - has the player won the game?
"""returnhas_eaten_all_dotsandnotlose(power_pellet_active,touching_ghost)