From f0a1fe16c3aaaebc962ebdab380bafd0e0edb6c3 Mon Sep 17 00:00:00 2001 From: Ben Harris Date: Mon, 27 May 2024 11:00:03 +0100 Subject: [PATCH] 19a: this approach almost works But not close enough to continue with it. --- 19/19a.bqn | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 19/19a.bqn diff --git a/19/19a.bqn b/19/19a.bqn new file mode 100644 index 0000000..1b8b267 --- /dev/null +++ b/19/19a.bqn @@ -0,0 +1,16 @@ +# Material types are ore, clay, obsidian, geode. + +# Initially just handle the first blueprint. + +robot_costs ← [⟨4,0,0,0⟩,⟨2,0,0,0⟩,⟨3,14,0,0⟩,⟨2,0,7,0⟩] + +Search←{ + 𝕊⟨·,stock,·⟩: ∨´0>stock ? ¯∞; # Bankruptcy is undesirable. + 𝕊⟨0,stock,·⟩: 3⊑stock; + 𝕊⟨time,stock,robots⟩: + •Show ⟨time,stock,robots⟩ + ⌈´Search¨⟨⟨time-1,stock+robots,robots⟩⟩∾{ + ⟨time-1,stock+robots-𝕩⊏robot_costs,(1⊸+)⌾(𝕩⊸⊑)robots⟩}¨↕≠robot_costs +} + +•Show Search ⟨5,⟨0,0,0,0⟩,⟨1,0,0,0⟩⟩ -- 2.30.2