# nbaocd


<!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! -->

`nbaocd` is a native [BasedPL](https://github.com/AnswerDotAI/basedpl)
port of [baocd](https://github.com/AnswerDotAI/baocd) for Advent of Code
puzzle data and answer submission.

## Installation

``` bash
pip install git+https://github.com/AnswerDotAI/nbaocd.git
```

## Setup

1.  Log in to [Advent of Code](https://adventofcode.com)
2.  Open browser Dev Tools and copy the `session` cookie.
3.  Set it as `AOC_SESSION` in your SolveIt secrets (or environment, or
    save it to `~/.config/aocd/token`).

## Usage

In SolveIt or Jupyter, load the extension once (this registers `%%bpl`
and calls
[`•load`](https://answerdotai.github.io/basedpl/system/load.html) on the
installed `nbaocd.bpl`):

``` python
%load_ext nbaocd
```

### Get Data

``` bpl
%%bpl
p ← get_puzzle ["day":1 "year":2026]
lines ← p.input_data 0
ex ← p.example 0
```

### Submit

``` bpl
%%bpl
p.submit answer
```

`p.input_data 0` returns a native
[BPL](https://github.com/AnswerDotAI/basedpl) array of split lines. For
the raw text format use `p.raw_input_data 0`.

### Standalone BPL (`•load`)

In the `bpl` CLI or BPL Jupyter kernel, load `nbaocd.bpl` directly with
[`•load`](https://answerdotai.github.io/basedpl/system/load.html) (get
the installed path via `python -c "import nbaocd; print(nbaocd.PATH)"`):

``` bpl
[get_puzzle:] ← •load "path/to/nbaocd.bpl"
```
