chiark / gitweb /
19a: correct maximum-cost calculation
authorBen Harris <bjh21@bjh21.me.uk>
Mon, 27 May 2024 13:16:38 +0000 (14:16 +0100)
committerBen Harris <bjh21@bjh21.me.uk>
Mon, 27 May 2024 13:16:38 +0000 (14:16 +0100)
19/19a.bqn

index 28be0de48a9203eca1c36b9bdc4237aee65340ee..04653f636213551046816c4222ed77d79e78a258 100644 (file)
@@ -20,7 +20,8 @@ Prep←{
 NtZ←{=˜𝕩 ? 𝕩; 0}¨ # NaN is not equal to itself.
 
 EvalBlueprint←{𝕊 robot_costs:
-  max_costs←⌈´˘robot_costs
+  •Show robot_costs
+  •Show max_costs←⌈˝(robot_costs∾[⟨0,0,0,∞⟩]) # Want all the geodes.
   Search←{ 𝕊⟨time,stock,robots⟩:
     #•Show ⟨time,stock,robots⟩
     result←⌈´{
@@ -37,7 +38,6 @@ EvalBlueprint←{𝕊 robot_costs:
     𝕊⟨time,stock,robots⟩:
     3⊑stock+robots×time  # If not, return number of geodes we can get in time.
   }
-  •Show robot_costs
   •Show Search ⟨24,⟨0,0,0,0⟩,⟨1,0,0,0⟩⟩
 }