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.

18 lines
482 B

defmodule Rules do
def eat_ghost?(power_pellet_active, touching_ghost) do
power_pellet_active && touching_ghost
end
def score?(touching_power_pellet, touching_dot) do
touching_power_pellet || touching_dot
end
def lose?(power_pellet_active, touching_ghost) do
! power_pellet_active && touching_ghost
end
def win?(has_eaten_all_dots, power_pellet_active, touching_ghost) do
has_eaten_all_dots && ! lose?(power_pellet_active, touching_ghost)
end
end