Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Command: sed -e'y/.#(){},/01[][] /' <input | dc -fdc-p1.dc
- # 10-bit XOR top two on stack
- [
- 0d # (i=bit#) result
- [
- 3R4R # arg2 arg1 i result
- 4~ 3R 4~ # (B-low2) Brest (A-low2) Arest i result
- 3R
- d_1r^3R*+4d3R+r% # (B^A low2) (B-rest) (A-rest) i result
- 4R d 2r^ 3R* # (bit<<i) i rest1 rest2 result
- 5R+ # (result+=bit) i rest1 rest2
- r2+ d A>L # i+=2, loop until i == 24
- ] dsLx 3R4R++s, # 3 result junk2 junk1
- ] s^
- ?
- [ lcsm ] sR
- [ lclm>R ] sP
- # Calculate numLights
- [
- zsl xzll- dsl # l = nunLights-1
- # stack: i junk1 junk2 ... junki ...
- [
- rs.
- 1- d0<D
- ] dsDx s.
- ] sC
- # Push Button: rest button=j i -> rest j i
- [
- lc1+sc # bitcount++
- rd;b lt l^x st r # test ^= button(j)
- ] sB
- [
- lCx # Calculate l = numLights-1
- z1- dsn # n = numButtons; i [butt1] [butt2] ... [lights]
- 0Sb # clear button array; stack: i [butt1] ...
- [
- dsi
- rx # b1 b2 ... i ...
- zli1+- 0r # j=length(butt1) bits b1 b2 ... i [butt2] ...
- [
- 3R llr- 2r^ 3R+ # bits |= (1 << l-b1)
- r 1- d0<J
- ] dsJx + # bits i [butt2] ... [lights]
- r d3R r:b # button[i] = bits; i [butt2] ...
- 1- d0<I
- ] dsIx s.
- #'b
- 2ixAi sT # lights T=targ
- Ad^ sm # min = 10000000000
- ln 2r^1- # i=2^numButtons-1
- [
- 0st # test = 0 (XXX: do this on stack?)
- 0sc # bitcount = 0
- dln # j=numButtons bits=i i
- [
- r2~ # lowBit rest j i
- 1=B # push button[j]; rest j i
- r 1- d0<J # j-- rest i (XXX: make test on bits == 0?)
- ] dsJx ++ # 0 0 i -> i
- ltlT=P
- 1- d0<I
- ] dsIx s.
- lplm+ p sp # print running total as status line
- ? z0<M
- ] dsMx
- [Part 1: ]nlpp
Advertisement
Add Comment
Please, Sign In to add comment