Coder Social home page Coder Social logo

adventofcode2023's Introduction

๐ŸŽ„ Advent of Code Template

Bun TypeScript ESLint

  • Bun & TypeScript, with ESLint
  • Automatic day setup
  • Puzzle input automatically fetched
  • Performance metrics

Setup

Download template (powered by unjs/giget)

npx giget gh:matijaoe/advent-of-code advent-of-code-2023

Ensure bun is installed:

bun -v

# if not installed, run this:
curl -fsSL https://bun.sh/install | bash

Install dependencies:

bun install

Set up a new day:

bun setup 1

Run day solutions:

bun day 1

Run day solutions in dev mode (without clearing console outputs):

bun day 1 --dev

For automatic puzzle input retrieval, define .env file with session cookie from adventofcode.com:

SESSION=
YEAR=2023

Structure

Generated day structure:

import { parseLines, readInput } from 'io'

const input = await readInput('day-01')

export const part1 = () => {
  const lines = parseLines(input)
  // your code goes here
  return lines.length
}

Expected index.ts solution structure (day 1 of 2022):

import { parseGroups, readInput } from 'io'
import { desc, sum } from 'utils'

const input = await readInput('day-01')

export const part1 = () => {
  const lines = parseGroups(input, Number)
  return lines.map(sum).sort(desc).at(0)
}

export const part2 = () => {
  const lines = parseGroups(input, Number)
  const top = lines.map(sum).sort(desc).slice(0, 3)
  return sum(top)
}

bun day <day-num> output:

๐ŸŒฒ Part One: 70698 (1.11 ms)
๐ŸŽ„ Part Two: 140471 (383.5 ยตs)

Days

โœ… / โŒ

Day Part 1 Part 2 Solution Advent of Code link
01 โญ โญ Link Day 01
02 โญ โญ Link Day 02
03 โญ โญ Link Day 03
04 Day 04
05 Day 05
06 Day 06
07 Day 07
08 Day 08
09 Day 09
10 Day 10
11 Day 11
12 Day 12
13 Day 13
14 Day 14
15 Day 15
16 Day 16
17 Day 17
18 Day 18
19 Day 19
20 Day 20
21 Day 21
22 Day 22
23 Day 23
24 Day 24
25 Day 25

adventofcode2023's People

Contributors

itsrainingmani avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.