Skip to content

Commit

Permalink
Day 16 solution.
Browse files Browse the repository at this point in the history
  • Loading branch information
jayfoad committed Dec 17, 2018
1 parent b060f3f commit 1f3cb2e
Show file tree
Hide file tree
Showing 2 changed files with 4,229 additions and 0 deletions.
33 changes: 33 additions & 0 deletions p16.dyalog
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
⎕IO0
p⎕NGET'p16.txt'1

an{2/(2/21+)}
or{2/(2/21+)}

addr{_ a b c w(cw)(aw)+(bw)w}
addi{_ a b c w(cw)(aw)+bw}
mulr{_ a b c w(cw)(aw)×(bw)w}
muli{_ a b c w(cw)(aw)×bw}
banr{_ a b c w(cw)(aw)an(bw)w}
bani{_ a b c w(cw)(aw)an bw}
borr{_ a b c w(cw)(aw)or(bw)w}
bori{_ a b c w(cw)(aw)or bw}
setr{_ a b c w(cw)(aw)w}
seti{_ a b c w(cw)aw}
gtir{_ a b c w(cw)a>(bw)w}
gtrr{_ a b c w(cw)(aw)>(bw)w}
gtri{_ a b c w(cw)(aw)>bw}
eqir{_ a b c w(cw)a=(bw)w}
eqrr{_ a b c w(cw)(aw)=(bw)w}
eqri{_ a b c w(cw)(aw)=bw}

all{16 4(addr,addi,mulr,muli,banr,bani,borr,bori,setr,seti,gtir,gtrr,gtri,eqir,eqrr,eqri)}

p1¨'\d+'⎕S'&'¨0 ¯1(+/'B'=¨p)4p
mat{x y z z1y all x}2p1
+/2<+/mat part 1

opsp1[;1;0]
map16/0 {}{map[nops]c1n11=+/ mm[;c]0m}16mat
p2¨{+/\ר}p
⊃⊃{map[] all }/p2,0 0 0 0 part 2
Loading

0 comments on commit 1f3cb2e

Please sign in to comment.