From c381fa64cf9d375290c76436faf1078bc8d81ff7 Mon Sep 17 00:00:00 2001 From: sterni Date: Sat, 10 Dec 2022 21:24:06 +0100 Subject: feat(sterni/aoc/2022): day10 BQN solution I cheated a bit to skip implementing multi cycle instructions. The VM is pretty much a normal tail recursive function, but working with scalars in BQN is on brand-ish. Array programming helps again when drawing the picture on screen. Change-Id: I2562c862e228f633c5fad09e503529c6e0785112 Reviewed-on: https://cl.tvl.fyi/c/depot/+/7556 Tested-by: BuildkiteCI Reviewed-by: sterni Autosubmit: sterni --- users/sterni/exercises/aoc/2022/10/10.bqn | 25 +++++++++++++++++++++++++ users/sterni/exercises/aoc/lib.bqn | 6 +++++- 2 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 users/sterni/exercises/aoc/2022/10/10.bqn (limited to 'users/sterni') diff --git a/users/sterni/exercises/aoc/2022/10/10.bqn b/users/sterni/exercises/aoc/2022/10/10.bqn new file mode 100644 index 000000000000..59cfa0e8d3c8 --- /dev/null +++ b/users/sterni/exercises/aoc/2022/10/10.bqn @@ -0,0 +1,25 @@ +⟨SplitOn,ReadDec⟩ ← •Import "../../lib.bqn" +# Instead of implementing the VM described in the problem, translate the +# program to instructions with equivalent timing for a similar VM that +# only needs 1 cycle for every instruction. +is ← ∾{"noop": <"noop"; 𝕩: (<"noop")∾