Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 20 additions & 6 deletions exercises/concept/ghost-gobble-arcade-game/arcade_game.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,39 +2,53 @@


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?
:param touching_ghost: bool - is the player touching a 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?
:param touching_dot: bool - is the player touching a 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?
:param touching_ghost: bool - is the player touching a 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?
Expand All @@ -43,4 +57,4 @@ def win(has_eaten_all_dots, power_pellet_active, touching_ghost):
:return: bool - has the player won the game?
"""

pass