pacman-rules

This commit is contained in:
Alexander Heldt
2025-10-30 19:47:49 +01:00
parent 70cfb196b8
commit 3c64c873ef
10 changed files with 298 additions and 0 deletions

View File

@@ -0,0 +1,19 @@
pub fn eat_ghost(power_pellet_active: Bool, touching_ghost: Bool) -> Bool {
power_pellet_active && touching_ghost
}
pub fn score(touching_power_pellet: Bool, touching_dot: Bool) -> Bool {
touching_power_pellet || touching_dot
}
pub fn lose(power_pellet_active: Bool, touching_ghost: Bool) -> Bool {
!power_pellet_active && touching_ghost
}
pub fn win(
has_eaten_all_dots: Bool,
power_pellet_active: Bool,
touching_ghost: Bool,
) -> Bool {
has_eaten_all_dots && !lose(power_pellet_active, touching_ghost)
}