diff --git a/exercises/concept/ghost-gobble-arcade-game/arcade_game.py b/exercises/concept/ghost-gobble-arcade-game/arcade_game.py index b2848e0c71..c8d859afe3 100644 --- a/exercises/concept/ghost-gobble-arcade-game/arcade_game.py +++ b/exercises/concept/ghost-gobble-arcade-game/arcade_game.py @@ -2,6 +2,11 @@ def eat_ghost(power_pellet_active, touching_ghost): + if power_pellet_active and touching_ghost: + return True + else: + return False + """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? @@ -9,10 +14,13 @@ def eat_ghost(power_pellet_active, touching_ghost): :return: bool - can a ghost be eaten? """ - pass def score(touching_power_pellet, touching_dot): + if touching_power_pellet or touching_dot: + return True + else: + return False """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? @@ -20,10 +28,12 @@ def score(touching_power_pellet, touching_dot): :return: bool - has the player scored or not? """ - pass - - def lose(power_pellet_active, touching_ghost): + if not power_pellet_active and touching_ghost: + return True + else: + return False + """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? @@ -31,10 +41,14 @@ def lose(power_pellet_active, touching_ghost): :return: bool - has the player lost the game? """ - pass + def win(has_eaten_all_dots, power_pellet_active, touching_ghost): + if has_eaten_all_dots and power_pellet_active and touching_ghost: + return True + else: + return False """Trigger the victory event when all dots have been eaten. :param has_eaten_all_dots: bool - has the player "eaten" all the dots? @@ -43,4 +57,4 @@ def win(has_eaten_all_dots, power_pellet_active, touching_ghost): :return: bool - has the player won the game? """ - pass +