tvl-depot/users/sterni/exercises/aoc/2022/18/18.bqn
sterni ba719f8f5e feat(sterni/aoc/2022): day18 BQN solution
Change-Id: I1504cd5e443ff0b28c2d97ae357e5d92c88bba4d
Reviewed-on: https://cl.tvl.fyi/c/depot/+/7601
Reviewed-by: sterni <sternenseemann@systemli.org>
Tested-by: BuildkiteCI
Autosubmit: sterni <sternenseemann@systemli.org>
2022-12-20 19:01:26 +00:00

14 lines
688 B
BQN
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

lib •Import "../../lib.bqn"
i (lib.ReadDec¨(<',')lib.SplitOn)¨ •FLines "input"
dim 1+´i
cubes i˜dim
views 012, 120, 201
Exposed {(6×+´𝕩)-2×+´views{+´(˝˘)2𝕨𝕩}¨<𝕩}
Interior {(¬𝕩)´views{((lib.Xor`(()»()))1)(𝕨)𝕩}¨<𝕩}
Displace {´(views){Fa 𝕊 𝕩:((-¬(»((0=)>)))1)(F a)𝕩}¨<𝕩}
Exterior (-Exposed ¯1=(Displace lib._fix)(-Interior+))
•Out "day18.1: "•Fmt Exposed cubes
•Out "day18.2: "•Fmt Exterior cubes