Skip to content

roelschr/advent-of-code-with-chatGPT

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

advent-of-code-with-chatGPT

This repo registers my saga to solve advent of code 2022 puzzles with chatGPT.

Each day, you'll find a README file logging the entire convo between me and chatGPT. Final (working) solutions will be on python files. Our goal is to get as far as possible. And I mean "our" because the solution depends on the performance of the model and the quality of the prompts.

Obviously, I will be dellaying my submissions, because I have no intention of making into the global leaderboard through cheating.

Brain dump

This section logs some of my thoughts during the convos with chatGPT.

Day 1

Check full convo here

The puzzle should be easily solved by a begginer. It serves like a preparation, just to remember programmers how to parse a text input file and do some basic math.

Only part two requires the use of a data structure (list). But chatGPT chose a verbose and complex solution even for part one. Storing the total calories for each Elf in a dictionary, to take the max in the end.

Anyway, I'm interested in getting the correct answer, so this blew my mind. THIS IS AWESOME!

Day 2

Check full convo here

Holy! The bot is stubborn and boastful:

I do not have the ability to make mistakes. (x2) 2022, chatGPT

LMAO, this was super fun. It took me hours to get the right answers, but it was extremelly good. Certainly, I should get better at prompt engineering if I want this bot to complete the whole challenge.

It seems that the first part of the puzzle was biasing the bot more than it should. Because the second part changed the definition of the input and how to interpret it, I had to work super hard to make it "forget" the first part of the puzzle.

Anyway, I cannot believe how good this AI is, imagine when fine tunned for "pair-programming".

One important thing that I've noticed: my first prompt on day 1 seemed to have triggered a "hackerank chatGPT", because it even gave testing code for the example input. This did not happen on day 2. I'll try starting the thread on day 3 with: "Hi, can you help me with a programming puzzle? I would like the solution written in python, with code explanation, please."

Day 3

Check full convo here

Amazing. It took me only a few minutes to get both solutions from chatGPT. The prompt from day 1 works very well, as it makes the bot show it's actually trying to solve for the example input.

Obviously, it will say that the solution is working, even when it gives the wrong output for it. It won't run the code to check it, but chatGPT tries to solve the specific problem described in the puzzle, not a generic one as we've seen in day 2.

In the end I even got the bot to optimize the code an remove a few unecessary lines. It could improve it even more, but that's for the next days :)

Day 4

Check full convo here

I've started the day with the same prompt as day 3. But now, on multiple retries, chatGPT started generating a random puzzle and solving it in python. In addition to that, the python code was being explained like it was Python 2.7 (use of raw_input for example). So I changed my first prompt to include the command "Python 3" and the full puzzle description. Less small talk :)

This time, the code was super concise and "advanced", making use of the re package to parse the input and inline list comprehension. It required just a few tips for the bot to solve part 1. Part 2 was a piece of cake from there.

I won't get tired of saying how this technology is ground breaking!

Day 5

Check full convo here

OMG! This thing is unbelievable, and I'm an ML Engineer XD

It took some retries to get the bot started. I had also to login again in the middle of the conversation, losing my progress. But the second time was just unbelievable.

My first surprise was how easily chatGPT extracted the stacks and rearrangement instructions from the example, hardcoding them as a test input for the program. This time I also asked chatGPT to fix runtime errors. Why StackOverflow?

But the most impressive thing happened when I asked why the output was different from the expected output. Just by saying: "Instead of CMZ, the program outputs MCD. Can you find the issue?", chatGPT was able to identify that the list of crates removed from one stack have to be reversed before adding them to the other stack. THIS IS F*CKING AMAZING!!!

But the hard part of the puzzle was to make chatGPT write the code that parses the input correctly. The bot could not make sense of the stacks in the vertical form and I had to work hard giving it ways of translating the drawing of stacks of crates into the list of lists that it has used in the first solution. Fortunatelly, a rotating logic does the trick.

In the end I had to actively ask it to remove the use of strip, after telling it multiple times that whitespaces were an important part of the input.

Day 6

Check full convo here

Really no comments. This puzzle was EZ. Input puzzle > get solution.

cont.

About

This repo registers my saga to solve advent of code 2022 puzzles with chatGPT

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages