USING: assocs fry kernel make math namespaces prettyprint sequences ; IN: aoc.2020.15alt : play-game ( seq n -- seq ) [ over length - swap dup % [ first2 swap ] H{ } map>assoc '[ building get [ length 1 - ] [ last ] bi _ 3dup 2dup key? [ at - ] [ 3drop 0 ] if , set-at ] times ] { } make ; : part1 ( -- ) { 0 3 1 6 7 5 } 2020 play-game last . ; : part2 ( -- ) { 0 3 1 6 7 5 } 30000000 play-game last . ; ! 19s