chiark / gitweb /
19a even faster
authorBen Harris <bjh21@bjh21.me.uk>
Tue, 28 May 2024 08:26:34 +0000 (09:26 +0100)
committerBen Harris <bjh21@bjh21.me.uk>
Tue, 28 May 2024 08:26:34 +0000 (09:26 +0100)
Merging the two "is it worth it?" checks.

19/19a.bqn

index d7f05cb0858b1129b794592313703c8b68aeb776..4a60aa3cca6656d12a2b460a3338bc58d88b92c6 100644 (file)
@@ -28,7 +28,7 @@ EvalBlueprint←{𝕊 robot_costs:
       needed←(𝕩⊏robot_costs)-stock
       needed_time←1+0⌈⌈´⌈NtZ needed÷robots
       # Build a robot if there's time and we might need it.
-      (needed_time≤time)∧(𝕩⊑stock<max_costs×time)∧(𝕩⊑robots<max_costs) ?
+      (needed_time≤time)∧(𝕩⊑(stock+robots×time)<max_costs×time) ?
       Search ⟨time-needed_time
        (stock+robots×needed_time)-𝕩⊏robot_costs
        (1⊸+)⌾(𝕩⊸⊑)robots⟩;