• self-checking ghost

Question related to mission Haunted House

 

The 'check_solution()' function in self-checking part, ghost move to 'W' only in most right room?

        if ghost % 4 and "W" in ghost_dirs:
            ghost_dirs.remove("W")

Why is not 'ghost % 4 == 1' ?

And,

        if ghost < 4 and "N" in ghost_dirs:
            ghost_dirs.remove("N")

Why is not 'ghost <= 4' ?