Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

y2022 day19 part2 needs something to prune branches #20

Closed
shnarazk opened this issue Dec 19, 2022 · 0 comments
Closed

y2022 day19 part2 needs something to prune branches #20

shnarazk opened this issue Dec 19, 2022 · 0 comments
Assignees
Labels
Rust in Rust

Comments

@shnarazk
Copy link
Owner

shnarazk commented Dec 19, 2022

Rust side

Copy the idea used in the BQN program, which uses the upper bounds of robots.

records

introduces the upper bounds of robots as the BQN version

commit time
ff7a60e 75.24
44c0d12 3.98

BQN side

The following change is a degression.

diff --git a/bqn/2022/day19.bqn b/bqn/2022/day19.bqn
index 033c888..cfd2262 100755
--- a/bqn/2022/day19.bqn
+++ b/bqn/2022/day19.bqn
@@ -15,13 +15,12 @@ Solve ⇐ { part 𝕊 line:
     𝕊 ⟨⟩: best;
     𝕊 to_visit:
       𝕊 ⟨⟩ { time‿resources‿robots 𝕊 next:
-          { 𝕊 i:
+          next { i 𝕊 next:
           upto< t ← time- w ← 1+⌈⌈´(i⊏masks)/robots÷˜(n ← i⊏bp)(0⊸⌈-)resources ?
-              { ¬∨´(∧´𝕩⊸≤)¨next ? next ⟨𝕩⟩⊸∾ ↩ ;@ } t∾(n-˜resources+w×robots)∾((1⊸+)⌾(i⊸⊑)robots)
+              { ¬∨´(∧´𝕩⊸≤)¨next ? ⟨𝕩⟩∾next ; next } t∾(n-˜resources+w×robots)∾((1⊸+)⌾(i⊸⊑)robots)
           ;
-              best ((¯1⊑resources)+(time-upto)ׯ1⊑robots)⊸⌈ ↩
-          }¨{robots<○(𝕩⊸⊑)limits }¨⊸/↕4
-          next
+              best ((¯1⊑resources)+(time-upto)ׯ1⊑robots)⊸⌈ ↩, next
+          }´{robots<○(𝕩⊸⊑)limits }¨⊸/↕4
       }´{⟨⊑𝕩,4↑1↓𝕩,5↓𝕩⟩}¨to_visit
   }
   (•Fmt n) lib.Debug Expand ⟨⟨0⟩∾⟨0,0,0,0⟩∾⟨1,0,0,0⟩⟩ # ⟨time,resources,robots⟩
@shnarazk shnarazk self-assigned this Dec 19, 2022
@shnarazk shnarazk changed the title y2022 day19 part2 needs something y2022 day19 part2 needs something to prune branches Dec 19, 2022
@shnarazk shnarazk added the Rust in Rust label Mar 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Rust in Rust
Projects
None yet
Development

No branches or pull requests

1 participant