Skip to Content
How to use cdbxAdvent of Code

Advent of Code

Advent of Code  is a set of programming puzzles that open one a day in December. cdbx gives you a ready workspace for it: a folder of Programs, a file for each day, your puzzle input fetched for you, and the puzzle open next to your code. You write the code yourself; the AI helps only if you want it to.

Set it up

  1. From 1 October to the end of December, Home shows an Advent of Code tile under “Make something new”. Click it. The first time, it asks whether to set up this year’s event or take the prep course first. After that it opens a short Where to? menu with your Advent of Code folders and the course; the one you used last is picked.
  2. Answer a few questions, one at a time (Enter moves on):
    • Folder name: “Advent of Code 2026” to start with. You can rename it any time.
    • Year: this year’s event, or an older one to practise on.
    • Starter code: a main file, one file per day with part1 and part2, and an inputs folder. Or a blank file.
    • Input helpers: small lines(), numbers() and grid() functions for reading input. Or write your own.
    • Your Advent of Code session (optional): lets cdbx fetch your input for you. See below.
    • AI help: Tutor gives hints and explanations first and writes a solution only when you ask. Off hides the AI chat in these Programs.
  3. cdbx makes the folder on your Programs page and opens it. Pick a language and click Create program.

Want to try another language too? Open the folder and add another program. Each Program is one language.

Setting up also turns on Advanced Mode, which shows the code editor and the Programs page.

Solve a puzzle

  • Open a day’s file, for example day05.go. The Day 5 tab on the right shows that day’s puzzle from adventofcode.com. The tab follows the file you’re in.
  • Press Run (⌘↵) in the day’s file. It runs that day: part 1 and part 2 on the example (inputs/day05.example.txt) and on your input (inputs/day05.txt), and shows how long each took. From main or any other file it runs the DAY set at the top of main. Programs set up before 6 November 2026 show an Update main button in the puzzle tab that switches them over, keeping your DAY. It only appears if you haven’t changed main yourself.
  • ⌘⌥] and ⌘⌥[ jump to the next and previous day file, and ⌘⌥P shows or hides the puzzle.
  • A run can take up to 5 minutes and use up to 1 GB of memory. If it hits either, Output says which. Rust, C and C++ are compiled with optimisation on (-O, -O2), and Rust uses the 2021 edition.
  • Run switches to Output. Click the Day tab to go back to the puzzle, or close it with × and bring it back with the + next to Output.
  • Paste the puzzle’s example into inputs/day05.example.txt yourself.

Starter code is ready for Python, Go, JavaScript, TypeScript, Rust, Java, Ruby, C++, C#, Kotlin, C, Haskell, Elixir, Swift, Zig, F#, OCaml, Julia, Lua and PHP. Other languages get the inputs folder and their usual main file. The viz file and the cdbx kit come with the first nine for now.

The puzzle tab shows the site signed out, so part 2 and the answer box aren’t there. Click Open to use adventofcode.com in a browser tab for those.

Visualize your solution

Draw your grid once per step and cdbx plays it back as an animation in the Visualize tab, under Output. Watching your code work is the quickest way to see why an answer is off.

Every Advent of Code program has a viz file next to the helpers, with the same three calls in every language:

from viz import frame, paint, say frame(grid, paint(seen, "green"), paint(queue, "gold", "o"), say(f"step {step}"))
  • frame(grid, …) draws one frame: your grid, then whatever you pass after it.
  • paint(cells, colour, char) colours a set or list of points, and draws char there if you give one. Colours: green, gold, red, blue, white, dim.
  • say(text) puts a caption above the grid, like the step or a count.

The top of each viz file shows how to call it in that language. You can also ask the AI to “draw my search as frames”.

Or print frames yourself. Print the terminal’s clear-screen code ("\x1b[H\x1b[2J") between grids and colour characters with the usual terminal colour codes. Code that already animates in your own terminal plays here as it is.

Frames don’t print in Output: it says how many there were (40 frames → Visualize). In Visualize, play, pause and step with the buttons or Space and ←/→, drag the bar, change the speed, and switch between Fit and 1:1.

  • Up to 5,000 frames per run. Longer runs keep every Nth frame, and the player says so.
  • Up to 200×200 characters per frame.
  • Drawing every step slows a run down. If it drags, draw every 10th step.

Time it with the cdbx kit

Every Advent of Code program also has a kit file: check tries a part on the example, bench.compare times two versions, and bench.growth tells you how the time grows as the input does, so you know whether it will finish on the real input. See The cdbx kit.

Fetch your input

Advent of Code gives everyone a different input, behind your sign-in. To have cdbx fetch it:

  1. Sign in at adventofcode.com in your browser.
  2. Open the developer tools, then Application (Chrome, Edge) or Storage (Firefox, Safari), then Cookies, then adventofcode.com.
  3. Copy the value of the cookie called session and paste it into cdbx (in the setup, the folder’s settings, or the puzzle tab).

Then click Fetch my input on the puzzle tab. Your input lands in inputs/dayNN.txt. cdbx keeps your session encrypted, never puts it in your code, and only uses it to fetch your own input. Sessions last about a month; if fetching stops working, save a fresh one. Forget it in the folder’s settings removes it.

The prep course

A course for the weeks before December, shaped like the event: 25 days, two parts each, a star for each part.

  • Part 1 teaches a pattern that comes back every December, like reading input, grids, breadth-first search, ranges, Dijkstra’s algorithm or finding a loop. Part 2 uses the same input and teaches the next step up: the faster way, the extra state, the case that breaks the simple answer.
  • Each part is Learn (the idea, with a picture you step through), a short warm-up, then our own puzzle. Most days, Learn first races the obvious way against the pattern on the same input, each counting its work, so you see why the pattern wins before you learn how it works. Try a bigger input to see the gap open up. On day 8 you can add walls to the map and race again. Check (⌘⇧↵) runs your code against the puzzle’s tests, including hidden ones, and gives you the star when they pass. If your code doesn’t compile, Check shows the first error and the line it points at; if it crashes, Check shows the crash message.
  • Review my code, on the warm-up and the puzzle, looks at how your code is written, at your level, any time, passed or not. Pick Beginner, Intermediate or Advanced (it guesses from your code until you pick, then remembers). It shows how many tests pass, how fast your code runs on the practice input, and how many small tidy-ups it found, then a few notes in order of how much they matter: Faster, Cleaner or Idea. Click a note’s lines to jump to them in the editor, or Explain it in chat to talk it through with the tutor. It explains; you make the change. Review again after you’ve changed your code shows what the change bought you, for example 410 ms → 0.6 ms. A review uses a few AI credits, or your own key if you’ve added one.
  • The tutor in the AI chat knows the day, the step you’re on and your last Check. It gives hints first and writes a solution only when you ask.
  • The chat opens in Tutor mode in the course and in Advent of Code programs: it explains and gives hints, and never changes your files. Switch it to Build if you want the AI to make a change for you.
  • The ? menu opens the cheat sheet: every pattern, how to spot it and the shape of its code. Below the patterns are the data structures the course uses (list, dictionary, set, tuple, stack, queue, heap, string): what each is, what it costs, and a short program in your language. Wherever a lesson names one, the word is a link to its card.
  • Day 25 has one puzzle. Its second star is for finishing the other 49, as on Advent of Code.

To start, click the Advent of Code tile on Home and choose Take the prep course first, then your language. It makes an “Advent of Code Prep” folder on your Programs page and opens day 1. The folder is the course page: your 25 days as a tree or a list, with your stars. Click a day to see both parts.

The days are in the order December usually needs them, and nothing is locked by order. Days 1 to 3 are free; the rest come with Pro.

Day 0 · Before you start sits above day 1 on the course page. It opens as its own page: what the course is about and what napkin math means, then six chapters on how fast a computer is, Big O, what lists, sets and dicts cost, memory, numbers that are too big, and recursion. Each chapter has something to play with (pick an input size and see how long two plans take, watch a list search lose to a set, step through a call stack), a worked example, and a Python snippet you can change and Run right there. The chapter list shows what you’ve read. It has no puzzle or stars, and ends with Start day 1.

Picking a language

The course is in Python, TypeScript, C#, Go and Rust. Pick the language when you start, or any time from the menu next to your stars on the course page. Each language gets its own Program in the course folder, made the first time you open a day in it, and your code in the other one stays where it is.

The lessons are the same in every language. The warm-ups, puzzle files, cheat sheet and Check all follow the Program you have open, and the Learn step adds a few tips for that language. Stars count once per day: pass day 3 in TypeScript and it’s done, whichever language you use next.

Your inputs stay yours

Advent of Code asks people not to share their inputs. In these Programs, anyone else who opens or copies one sees the inputs files empty, and they’re left off public pages. Your own downloads and GitHub exports include them; that’s your choice.

Folders

Any Programs can go in folders, not just Advent of Code ones.

  • New folder on the Programs page makes one.
  • Move to folder… in a Program’s ⋯ menu puts it in a folder, moves it to another, or takes it out.
  • Folders are one level deep, and a Program is in one folder at most.
  • Delete folder keeps the Programs that were in it; they go back to the top of the page.

An Advent of Code folder also has Folder settings: AI help, what new Programs start with, and your session.

Last updated on