Last active
July 21, 2021 10:57
-
-
Save mcsf/7ba1266dba0cda0f1fd11f5139112d6e to your computer and use it in GitHub Desktop.
Advent of Code 2019, day 08
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env awk -f | |
{ | |
delete counts | |
for (i = 1; i <= NF; i++) counts[$i]++ | |
if (! min || counts[0] < min) { | |
min = counts[0] | |
result = counts[1] * counts[2] | |
} | |
} | |
END { print result } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl -p | |
s/.*?(0|1).*/\1/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
W=25 | |
H=6 | |
LAYERS=$(fold -w $((W * H)) | sed 's/\(.\)/\1 /g') | |
# Part 1 | |
<<< "$LAYERS" ./checksum | |
# Part 2 | |
<<< "$LAYERS" rs -T | ./find-first-meaningful-pixel | rs $H $W | sed 's/0/ /g' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment