Conversation
gigamonkey
left a comment
There was a problem hiding this comment.
Various comments. Including you need to test your solution.
|
|
||
| set -euo pipefail | ||
|
|
||
| cmd puzzle/duplicates.txt | uniq -c | sort -r | head -1 No newline at end of file |
There was a problem hiding this comment.
Also, you need to sort the input to uniq as uniq only looks at adjacent lines.
There was a problem hiding this comment.
And head -1 gets you the right line but then you need to get rid of the count to emit only the secret.
Basically, you need to test your code by building a puzzle and then trying to use your solution to get the green checkmark.
| last-line | ||
| nth-line | ||
| sha-line | ||
| backwards |
There was a problem hiding this comment.
Why'd you delete backwards? (You should always look at the diff of your PR to make sure the changes are what you intended.)
| set -euo pipefail | ||
|
|
||
| # shellcheck source=/dev/null | ||
| source "$(dirname "$0")/lines.sh" |
There was a problem hiding this comment.
I don't think you actually need to use these functions. Probably better is to use the fake_id function that you get automatically to make a bunch of fake secrets that are the same as the real secret but with a different number (making them not valid secrets). Then generate a file full of a fake secrets each repeated between 2 and 12 times and one instance of the real secret and shuffle it and there's your puzzle input.
| # random_fake_lines "$FILE" 12 "$1" | ||
|
|
||
| for ((i = 1; i <= 12; i++)); do | ||
| line=$(head -"$i" "$FILE" | tail -1) |
There was a problem hiding this comment.
Here's where you can use fake_id to make a fake secret each time through the outer loop.
|
I fixed the problems, the puzzle works now. Also there might be some conflicts in the backwards puzzle, since I noticed that the backwards puzzle used both reversed.txt and backwards.txt for the file that the puzzle was in. It was probably a change I made by mistake but there's a possibility I set it to the wrong one when I fixed it |
No description provided.