Skip to content

S3B4S/advent-of-code-2024

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Dec 25, 2024
939ba74 Β· Dec 25, 2024
Dec 5, 2024
Dec 5, 2024
Dec 5, 2024
Dec 5, 2024
Dec 16, 2024
Dec 5, 2024
Dec 15, 2024
Dec 7, 2024
Dec 14, 2024
Dec 9, 2024
Dec 16, 2024
Dec 11, 2024
Dec 16, 2024
Dec 15, 2024
Dec 15, 2024
Dec 15, 2024
Dec 16, 2024
Dec 21, 2024
Dec 25, 2024
Dec 19, 2024
Dec 20, 2024
Dec 25, 2024
Dec 23, 2024
Dec 24, 2024
Dec 25, 2024
Dec 25, 2024
Dec 6, 2024
Dec 25, 2024
Nov 14, 2024
Dec 18, 2024
Dec 5, 2024
Dec 11, 2024
Dec 6, 2024
Dec 6, 2024

Repository files navigation

Advent of Code 2024

A collection of coding puzzles and challenges implemented in TypeScript using Deno.

Features

  • πŸ—οΈ Automated scaffolding for new challenges
  • βœ… Test-driven development setup
  • πŸ§ͺ GitHub Actions CI pipeline
  • 🎨 Code formatting and linting
  • πŸ“ Input file handling
  • πŸ› οΈ Utility functions for common operations

Getting Started

Prerequisites

  • Deno v2.x installed

Installation

  1. Clone the repository

Creating a New Puzzle

You will need an Advent of Code session cookie for fetching puzzle inputs, set to the AOC_SESSION_COOKIE environment variable (or use an .env file).

Use the scaffold command to create a new challenge directory with all necessary files:

# For todays puzzle
deno task sd
# For a specified puzzle
deno task sd -n "challenge-name" -d <day-number>

This will:

  • Create a new directory with the format DD_puzzle-name
  • Generate boilerplate solution and test files
  • Download the puzzle input automatically
  • Set up example test cases

Project Structure

β”œβ”€β”€ scripts/
β”‚   β”œβ”€β”€ day-builder.ts    # Scaffolding script
β”‚   └── templates.ts      # File templates
β”œβ”€β”€ utils/
β”‚   β”œβ”€β”€ board.ts          # Grid/board utilities
β”‚   β”œβ”€β”€ hashSet.ts        # Custom HashSet implementation
β”‚   └── misc.ts           # Misc helper functions
β”œβ”€β”€ DD_puzzle-name/       # Puzzle solutions
β”‚   β”œβ”€β”€ index.ts          # Solution implementation
β”‚   β”œβ”€β”€ index.test.ts     # Tests
β”‚   └── input.txt         # Puzzle input
└── deno.json             # Deno configuration

Testing

Keep in mind that addiitonally you need to grant permissions when using Deno (-A to grant all permissions), --watch is also very useful when solving a puzzle.

Run all tests:

deno test

Run specific day's tests:

deno test DD_puzzle-name/

Run only example tests (used in CI):

deno run test:CICD

Key Components

Board Class

  • Coordinate-based navigation
  • Directional movement
  • Neighbor detection
  • Boundary checking

HashSet

A custom Set implementation that allows complex object storage using custom hash functions.

CI/CD

GitHub Actions workflow is configured to:

  • Run linting
  • Execute example tests
  • Verify code quality

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published