def within_one
import minebender-game@1.0.0.0/LAWS.bend as LAWSimport Base
import minebender-game@1.0.0.0/types.bend as T
42# p and q are at most one step apart in each direction (or the same cell).
43def within_one(p: T.Pos, q: T.Pos) -> Bool:
44 match p q:
45 case T.Pos{px, py} T.Pos{qx, qy}:
46 Nat.is_le(dist(px, qx), 1n) && Nat.is_le(dist(py, qy), 1n)