Paste: aoc day 10

Author: jonenst
Mode: factor
Date: Mon, 10 Dec 2018 12:58:51
Plain Text |
! explore with printing the size
! find the mind
! lookup the bounds
! print around those bounds

: printit ( hash -- str )
[ 100 300 [a,b] [
  300 100 [a,b] [ 2array swap at [ "#" ] [ "." ] if write ] with with each nl
] with each ] with-string-writer ;
: size ( hash -- str )
  keys [ [ first ] map ] [ [ second ] map ] bi
[ [ supremum ] [ infimum ] bi - ] bi@ * ; 
: animate ( hash -- hash' )
[ [ v+ ] keep ] assoc-map ;
"/tmp/input" ascii file-lines [
  "<,>" split { 1 2 4 5 } swap nths
  [ [ CHAR: space =  ] trim string>number ] map
  2 group
] map

10027 [ animate ] times dup . printit reverse print

New Annotation

Summary:
Author:
Mode:
Body: