function isSafe(x: integer, z: integer, w: string):: boolean: set {_b} to block at location({_x}, 255, {_z}, world({_w})) set {_n} to 0 while {_b} is air: add 1 to {_n} set {_b} to block at location({_x}, 255 - {_n}, {_z}, world({_w})) if {_b} is water or lava: return false else: return true