Responses for exercises in Exercism.
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
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
|