Using OpenAI ChatGTP to solve advent of code 2022 – Day 1

I’m recording my interactions with OpenAI ChatGTP to solve advent of code, here is some context.

Part 1

I ask it to solve a problem, but hit the enter key too early, without giving the problem.
It gave an answer anyway. Obviously it didn’t solve our problem. We can notice that the program works, and actually solve the problem “sum the numbers in a file, each number in one row”.

Adding the real problem

So I put the real problem (screenshot is cut, real puzzle is here):

And the answer:

Funny thing, it give context and explain a bit what the program is doing.
But, unfortunately, the program doesn’t give a valid solution. After reviewing the code, I see that it’s considering the first value of each group as the name of the group, but there is no name only values. Let’s give it this information…

Here we see one of the ChatGTP’ strength , the ability to remember the conversation.
After a quick review, I noticed that it understood that it had to change elf, the program is almost doing it but the issue is that the part where it want to change elf, it take always the same name “Elf”.
We’re close…

This time, the program gives the correct answer!

Part 2

Let’s try the direct approach

Well, it worked directly, nothing to add!


Posted

in

by

Comments

2 responses to “Using OpenAI ChatGTP to solve advent of code 2022 – Day 1”

  1. Thithi Avatar
    Thithi

    C’est la mort des tests de coding 😀

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.