Codex and the Advent of Code challenge

Hi everyone!
In case you are not familiar, the Advent of Code challenge takes place every year at this time. It’s a coding challenge where everyday (until 25th December) a new puzzle has to be solved.
This year, due to my increasing interest in AI, I decided to take the challenge in a different way: using only a prompt and no tinkering with code, have AI generate an acceptable solution (no errors, passes the test).

The full code and my prompts can be viewed here: GitHub - nunodonato/advent-of-code-2021: Experiments with AI and Codex to solve Advent of Code puzzles (I use PHP by the way)

On my blog, I’m writing some comments of the experiences and changes I had to do to get to a good prompt. I’m also making some comparisons between GitHub Copilot and the direct use of Codex. The first day is already published: Advent of Code Day 1 – Nuno Donato

I’d love to hear thoughts of more experienced folks about the prompts I’m making and how I can improve them. I struggled a bit, and today is only the 1st day so… things will get harder :sweat_smile:


Today’s challenge Advent of Code Day 2 – Nuno Donato
Part 1 was solved in a flash by copilot
Part 2 required some tinkering with the prompt

What was interesting to notice today was that the model was really INSISTING in having things his way instead of following instructions. I’m guessing because the instructions were somehow against what the model was trained with(‘up’ usually adds instead of subtracting)