Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Command: tr '.#' '01' <input | dc -fdc-p1.dc
- [lp1+sp] sC # count fitting set
- [[lk1+d sk :k] sA] sK # Change A macro to append to keys
- 128 ss
- 2i # Binary input
- ?
- [
- [ll1+ dsl :l] sA 0=K # Default to append to locks, change to keys if first == 0
- # Read in image:
- 0d? # stack: bitRow line=0 acc=0
- [
- r d2r^ 3R # bitRow shift line acc
- [
- 2~ # lowBit rest shift line acc
- 3Rd 3R* # shift*lowBit shift rest line acc
- 5R+_4R # acc+=shift-bit, tuck back
- ls* # shift-shift
- r # rest shift line acc
- d 0<B
- ] dsBx *+ # line acc
- 1+ ? z2<L # bitRow line++ acc
- ] dsLx s.
- lAx # append bitArray
- ? z0<I
- ] dsIx
- Ai # decimal
- ll # l=lock#
- [
- lk # k=key# l
- [
- d;k 3R d;l # lock(l) l key(k) k
- 3R+ # sum=lock+key l k
- # Test sum for overflow
- 0r # sum test=0 ...
- [
- 64~r2~ # bit7 higher lower-junk test ...
- 4R+ # test+=bit7 high low
- 3Rs.r # rest test...
- d 0<R
- ] dsRx + # sum replaced with test result (sum of every 7th bit)
- 0=C # p++ if test passed (0); l k
- r1- d0<K
- ] dsKx +
- 1- d0<L
- ] dsLx
- [Part 1: ]n lpp
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement