Skip to content

day 11 #1

@pindash

Description

@pindash

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions