Skip to content

Instantly share code, notes, and snippets.

@tomtheisen
Last active December 15, 2019 05:49
Show Gist options
  • Save tomtheisen/d3bd98f66cfecc266d83fdf09d98cb85 to your computer and use it in GitHub Desktop.
Save tomtheisen/d3bd98f66cfecc266d83fdf09d98cb85 to your computer and use it in GitHub Desktop.
AOC2019 stax solutions

AOC2019 stax solutions

Here are some of my stax solutions for Advent of Code 2019. Input goes verbatim in the input box.

Day 1

Part 1

Fe3/2-+

Part 2

Fe{0>}{3/2-gfDF+

Day 2

There aren't really optimally golfed.

Part 1

Lr12O&2c&
0Y{[@
  X1={|Y|Y\[@[@|+n|Y@s&}M
  x2={|Y|Y\[@[@:*n|Y@s&}M
  |Yx99-
w
dh

Part 2 - runs for almost 2 minutes here

Lr
4|Arf
  AJ|%\
  [O|%
  0Y{[@
    X1={|Y|Y\[@[@|+n|Y@s&}M
    x2={|Y|Y\[@[@:*n|Y@s&}M
    |Yx99-
  w
  d"8L\0"%=

Day 4

These are slow again. The general idea is to convert to string and check for non-descending sequence. Then use run-length instructions.

Part 1

N|rF$X:^x:G%6<*+

Part 2

N|rF$X:^x:G2#!!*+

Day 8

Part 1

iAJM
{'0#oh
o:GE*

Part 2

iAJMM
{'2-h. #@m
6Mm

Day 10

Part 1

L{'#|Ii\+FX
F
  x{n\{E-m:_m
  sdu%vT

Day 15

Part 2 - this takes the rendered grid, rather than the provided input. I generated it in a separate C# program.

L{
  {{"\.O".oOR"O\.".OoRmM}D
  {.oO|tm
gu%v
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment