It was a minor tweak, but yeh, didn’t look as nice as my original solution ![]()
I can’t even imagine how I would go about that?
PS:
I am also bugfixing my stupid php script for the 100th time:
I am so glad I don’t have to program php regularly.
And once my server is up and running, I am going to ask all you fine programming language experts what is the best language today to set up a frontend-to-database ideally with a single file (it’s a web-form that writes stuff into a mysql table). I hate php and I am terrible at it but at the time it was the quickest thing with the least overhead.
Day 6: rather easier than I expected.
All right, I did hardcode the constants in part 1, but it was easy enough to parameterise for part 2.
Day 6 sounds a bit too much like something I’ve had to do at work with sockets. Will give it a go later.
Very pleased that my solution for part two required the addition of a single character to my solution for part one.
Python lets me convert strings directly into sets of characters very neat.
For reasons I don’t understand, my solution for part 2 didn’t work with the real data. It worked for the samples, it worked for the first part, it worked with generated test data. Very weird. I did it a slight different way, which worked
Those are the really hard ones. There have definitely been times when I wanted to say “gimme twenty more small test cases”.
Day 7 got a little crunchy.
Admittedly, mostly on the input parsing side. But I ended up bodging up a sort-by-length to work out which values should include which other values. (Initial error: yes, it turns out that anchorsearching for the whole string will indeed match, as of course it should.) After that, well, I’d already written a values method for PostScript dicts.
Looks a little bit too much like work again. After my day at work I might have to give it a bit before having a go.
I feel like Day 7 has been the first day worth spending an hour on. Unfortunately I spent, likely, 2 hours on it (because I am my own worst enemy).
Fortunately, though, my rigor paid off; part two took me approximately 30 seconds to do.
I resisted the urge to structure the whole thing like an actual filesystem; and instead did my usual OO approach, which was very pleasing.
Due to my server stuffs (which are now largely done) I am lagging behind. Will try to get some coding in tomorrow and definitely on Friday
Looking forward to that.
AoC day 8:
Ah, now that starts to feel like a classic AoC. In each part I ended up with four similar code blocks for the four directions; in another language that would have been two or even one. I fear the end of my PostScript run is in sight.
AoC Day 8:
Reading comprehension is a thing, ain’t it?
I got stuck on Part 2, and rather than re-read the instructions, I went to browse the AoC subreddit looking for non-spoiler hints. Delightfully, I found the one I needed in the form on a meme that exactly replicates the issue I was dealing with:
Also do not start coding without reading the full problem spec. (Part 2 spoiler.)
Any edge cell will have value 0, any non-edge cell will have value >0, therefore I can just chop off the ends of the x/y iteration.
So day 6 was a bit on the easy side. Just a small loopy loop
Which is good since I am lagging behind.
Day 6
int magicNumber = 14;
for(int idx=0;idx<line.length()-magicNumber;idx++){
if( line.substring( idx, idx+magicNumber ).chars().distinct().count()==magicNumber){
return idx+magicNumber;
}
}
And now we’re off to dinner ![]()
It probably shows my age that
my first reaction is “build two nested loops, 0…n-2 → A, A+1…n-1 → B, if N[A] == N[B] then fail”, while these days you can make the language do the work with a set or similar construct that counts automatically.
Day 9 is definitely being made harder by PostScript’s design choices. Otherwise fun, and definitely a worthy part 2.
Specifically I can’t say f[a][b] += c, I have to do the aliasing manually, so it’s something like (not tested):
f dup
a get dup
b get
c add
b exch put
a exch put
Catching up today.
I started day 7 by rolling my own tree classes. Then I decided I probably didn’t need to. Got to the end of the re-write and then decided that I probably do need to.
This is taking a bit longer than previous days.
Actually, on second thoughts…
Curse you repeated folder names ![]()
Got there in the end.
Every time I download the input for day 8 it gets deleted.

