The Joys Of Programming

Today's problem was pleasantly easy. I wish they all could be

Okay, sunk a couple of hours into advent and so far I have an awesome dev UI set up, with HMR for the solution code, realtime feedback for testing mocked inputs, etc.

Am I done, or is there something else I'm supposed to do?

Does anyone here work in cloud ops? If so I would like to pick your brain.

That's a very broad area, and asking to ask a question is usually an unnecessary step.

Kurrelgyre wrote:

That's a very broad area, and asking to ask a question is usually an unnecessary step.

I just don’t want to ask it publicly, necessarily. And especially considering the people who have experience with cloud hosted ops might be smaller than I’m anticipating.

Quite late to the party, but I got caught up on advent. Smooth sailing so far, he's being very gentle (or else I'm just accustomed to how he makes problems).

My vanilla JS solutions are on github, if anyone's interested.

fenomas wrote:

Quite late to the party, but I got caught up on advent. Smooth sailing so far, he's being very gentle (or else I'm just accustomed to how he makes problems).

My vanilla JS solutions are on github, if anyone's interested.

Some folks may crap on JS, but I dig the nice clean repo and code, and there's something immensely appealing about seeing these solutions just run natively within a browser.

merphle wrote:

there's something immensely appealing about seeing these solutions just run natively within a browser.

I'm not picky about languages per se, but having a powerful UI layer and debugger and profiler and tons more - installed and updated and available on practically anything with a screen - is pretty convenient.

So this is me right now:

IMAGE(https://i.redd.it/f7svybrhgf4a1.jpg)

Most annoying - test sample works great.

Yeah, the thing that tripped me up today was that directory names can repeat within different subdirectories (i.e. /a/foo and /b/foo are legal), because of course they can, logically, but my initial design assumed they wouldn't, for optimization.

So I sorted out my part 1 problem - didn't take into account directories with no files - but part two is eluding me. I'm struggling with rolling the filesizes up the directory hierarchy.

I'll press on tomorrow and maybe be able to swing back and revisit part 2 later on.

Some hints for 7 that helped me crack it:

Spoiler:

The input walks the directory structure in a systematic way. It lists each directory once and only once, and it visits each subdirectory in order. Therefore you can assume that once you 'cd ..' out of a directory you will never revisit it and know the final value for its size. This means that you don't actually need to track directory names (you can assume that every time you 'cd' into a directory it is a valid directory name). In fact, you can probably get away without tracking the tree structure either, although I didn't go that far.

I also put up my solutions on github. They're in Haskell, so don't look if you're allergic to functional programming.

Have folks been playing with the recently powered-up AI chat bots? ChatGPT is the big one - character.ai is also impressive, though it seems like more of a toy to kill some time, than useful tool.

I've been having a ball with them - the other night I had ChatGPT compose a humorous four-stanza poem about the characters in my D&D group. It managed to build in end rhymes using the character names (which were made-up fantasy words), and ended on a punchline funny enough to crack up the group. Pretty mind-blowing stuff.

Thanks Jontra. That may help.

Yesterday was really busy and I didn't have long to play at coding, so I'm falling behind

Going to put time in today and tomorrow and try to catch up. I'm glad I dived into this. My programming chops are getting the rust knocked off.

For christmas I am printing one of my wife's hobby novels. I had GPT3 generate a foreword by "Stephen Fry" and you can totally picture him writing this.

Not Stephen J Fry wrote:

Dear Reader, It is with great pleasure that I introduce you to this
extraordinary novel, written by a creative woman author. It is a cosmic
horror story, a genre that has fascinated me for years, and this book is
a truly innovative contribution to it.
The story follows a group of people as they confront a mysterious force
that threatens their lives and their sanity. It is a gripping tale, full of
suspense and terror, and it will keep you on the edge of your seat as
you read. As the characters battle against the unknown, they must also
grapple with the moral and ethical dilemmas that come with their
choices.
This book is a testament to the power of imagination and the potential
of storytelling. It will take you on an unforgettable journey, and make
you question the nature of reality and our place in it. I urge you to take
up this book and explore its depths. You won't be disappointed.
Warmest wishes, Stephen Fry

The prompt was as simple as 'a foreword by Stephen J Fry to a new cosmic horror novel about (something something about the story)', less than 2 lines of text for the prompt.

I asked the OpenAI Playground "Generate a Monty Python sketch set in a Mars colony" and here's what it came back with, almost instantly:

Not Monty Python wrote:

(Scene opens with a group of colonists conversing in a Martian colony. They are wearing the appropriate space suits and are seated in a circle.)

COLONIST 1: So, what do you all think of living on Mars?

COLONIST 2: It's definitely an adventure. That's for sure.

COLONIST 3: It's not easy, that's for sure. The gravity is different, the air is different, the food tastes different.

COLONIST 4: (Sighs) I miss Earth.

COLONIST 1: Don't worry, we'll be back soon enough.

COLONIST 5: (Suddenly stands up) You know what? I've had enough of this! I'm going to find a way back to Earth!

COLONIST 2: (Rolls eyes) How?

COLONIST 5: I'm going to build a giant slingshot! (Points to the sky) I'll use it to launch myself back to Earth!

ALL: (Stare at Colonist 5 in disbelief)

COLONIST 4: That's the craziest thing I've ever heard!

COLONIST 5:

Sadly, it looks like it got cut off at the end (because I didn't commit enough tokens?), and my rerun generated something completely different.

merphle wrote:

I asked the OpenAI Playground "Generate a Monty Python sketch set in a Mars colony" and here's what it came back with, almost instantly:

...

Sadly, it looks like it got cut off at the end (because I didn't commit enough tokens?), and my rerun generated something completely different.

Based upon your prompt, generating something completely different was exactly what you requested.

Hrdina wrote:
merphle wrote:

I asked the OpenAI Playground "Generate a Monty Python sketch set in a Mars colony" and here's what it came back with, almost instantly:

...

Sadly, it looks like it got cut off at the end (because I didn't commit enough tokens?), and my rerun generated something completely different.

Based upon your prompt, generating something completely different was exactly what you requested.

Yup, my choice of phrase here was chosen carefully.

Today I went from "never having heard of" to "implemented" Lee's Algorithm.

Today was a good day.

I don't remember how Advent of Code went in past years but here on day 14 we've already gone through state machines, search algos, and now iterated simulations. I'm curious what we'll be doing by the time it gets to the last few days!

fenomas wrote:

I don't remember how Advent of Code went in past years but here on day 14 we've already gone through state machines, search algos, and now iterated simulations. I'm curious what we'll be doing by the time it gets to the last few days!

Day 25: Santa needs you to generate an image using these 1000 words as a guide. You'll be graded on imagination and creativity. Go!

I've started reading https://www.reddit.com/r/adventofcode

It's been a great help in understanding approaches to take to solve the problems. We're already so far from the knowledge I've gained from an almost entirely self-taught career.

It's where I learnt about Lee's Algorithm, for example.

Today I learnt that Advent of Code is designed to become more and more complex each day and that it's not unusual to tap out before Day 25. So I don't feel so bad about last year's halt on Day 8. Already done better this year and haven't given up yet!

If nothing else, I'm getting pretty good at parsing the input data

Moggy wrote:

Today I learnt that Advent of Code is designed to become more and more complex each day and that it's not unusual to tap out before Day 25. So I don't feel so bad about last year's halt on Day 8. Already done better this year and haven't given up yet!

The stats page does a pretty good job of showcasing the daily dropoff rate.

I got gold stars up through day 11, but day 12 broke me.

Note that the AoC calendar is available every year back through 2015, and you can still complete all the old daily puzzles whenever you want.

One problem I've had in the past with AoC is that lots of people post their solutions, but it's not so easy to find gentle hints. If anyone is stuck on one but doesn't want to give up, a couple of us here in the thread are fully caught up (for now ), so ask away!

Edited to add: today (day 16) was a doozy, and boy do the stats reflect that. @[email protected]

Advent of code day 17 was absolutely brutal... I worked on it almost non stop for 8 hours before finally cracking part 2. Gave up and decided to go to bed, but had a flash of insight while brushing my teeth and realised what I got wrong. Hopefully they don't get too much harder from here. It's going to be hard enough to keep up over Christmas as it is.

Day 16 part two threw me for a couple of loops, and it took me a long time to think up a working approach (thinking time, not typing time, fortunately).

Day 17, I hit the key insight for part two quickly - I think because I've done some leetcode stuff lately (need to find a job soon!), so I have a finely-tuned sense of "that right there is a number specifically chosen to be small enough for integer math but too large for O(n) iteration".

Edit: either I'm biased by being really accustomed to working with voxels, or Day 18 was waaay easier than 16-17.

Where I am state of play:

Day 7 pt 2 - Still need to go back and debug. I'm walking the tree correctly, just not doing my adding right
Day 9 pt 2 - need to modify my pt1 code to iterate through 10 times per tick
Day 13 - I saw all them nested brackets and just noped out. Need to man-up
Day 16 - trying a Monte-Carlo approach (cos there's no way I can be more systematic with my skill base) and need to fine tune my "which way to go next" randomness better. I'm also getting greater pressure relief than the test cases show, so my adding is borked again. Someone posted up another 4 test cases onto reddit/aoc, so that's proving helpful
Day 17 - I'm pretty sure I can brute force my way through Pt 1 at least. Just need to take the time
Day 18 pt 2 - I had changed my approach to doing a BFS from the outside, but it's bugged.
Day 19 - so my approach of "build the most expensive robot I can" doesn't work. Looks like I need to use a similar approach as Day 16. So Monte Carlo (I guess) Or I can try walking down a "build a robot?" decision tree. Dunno...

Day 18 was indeed a lot easier than the previous days. 19 was pretty tough though. I managed to get a solution but it takes a couple of minutes to run. I will hopefully come back to it later and figure out a more efficient version.