adventofcode

https://adventofcode.com/
Log | Files | Refs

puzzle_1.apl (258B)


      1 #! /usr/bin/apl --script
      2 
      3 input← { ⍎(⍴ x)[2] ⍴ x←0 ⎕CR ⍵ } ⎕FIO[49] 'files/1.txt'
      4 (+/ (((input, 0) - (0, input)) > 0)) - 1 ⍝ part 1
      5 
      6 i← ((0, 0), input) + ((0, input), 0) + ((input, 0), 0)
      7 (+/ (((i, 0) - (0, i)) > 0)) - 3 ⍝ part 2
      8 
      9 )OFF