Created
September 25, 2022 19:53
-
-
Save vKxni/c49c94cf948fe76b7b1b502c7df1ea28 to your computer and use it in GitHub Desktop.
Rules of the PacMan Game
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule Rules do | |
def eat_ghost?(power_pellet_active, touching_ghost) do | |
power_pellet_active and touching_ghost | |
end | |
def score?(touching_power_pellet, touching_dot) do | |
touching_power_pellet or touching_dot | |
end | |
def lose?(power_pellet_active, touching_ghost) do | |
not power_pellet_active and touching_ghost | |
end | |
def win?(has_eaten_all_dots, power_pellet_active, touching_ghost) do | |
has_eaten_all_dots and not lose?(power_pellet_active, touching_ghost) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment