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

day 11 #1

Open
pindash opened this issue Dec 13, 2020 · 0 comments
Open

day 11 #1

pindash opened this issue Dec 13, 2020 · 0 comments

Comments

@pindash
Copy link

pindash commented Dec 13, 2020

you can use arthur's sparse.q
to create the same table you have, but marching over the matrix all at the same time should be the fastest by of finding neighbors.
sm:{([]row:where count each i;col:raze i;val:raze x@'i:where each x<>0)}

c:raze "L"=i;l:raze "#"=i;
s:{(count x;count first x)} i
d:{x!s sv flip x}flip s vs til prd s
p:flip key d
m:{{?[c y;y;d flip x+s vs y]}[x]/[d flip x+y]}
n:(1_{x cross x}0 1 -1) m: p
seat:{c*(5>a)&x|0=a:sum 0^x n}
sum seat over l

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant