Giter Club home page Giter Club logo

adventofcode2022's Introduction

Advent of Code 2022

My solutions for the Advent of Code 2022 puzzles, implemented in C++.

Code for each solution is under the src/ directory, sorted by day.

Installing Dependencies

You'll need make, {fmt} and a C++20-capable compiler to build the solutions in this repo. You can install the latest versions of all dependencies using Homebrew.

Start by installing the Homebrew package manager if you don't have it already:

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

You can then install all dependencies with the brew command:

brew update && brew install gcc@12 make fmt

Building and Solving

To build a solution, cd into its source directory and simply run make.

A make run target is also provided for running the solutions right away. Forwarding arguments to the solution through this target can be done by setting an environment variable like such: make run args='<arg-list>'. For usage of a specific solution, check the comment block just above the main function in its source file.

Once the correct solution for part one of a puzzle is found, create a file named pt1.answer in the solution's source directory (i.e. make run > pt1.answer), any subsequent runs of this solution will execute code to solve the puzzle for part two instead. Deleting the file reverts this behavior.

Debugging with Visul Studio Code:

Provided in the .vscode/ directory are the necessary configuration files for building and debugging a solution using Visual Studio Code's integrated debugging tools.

Before following these steps, make sure you have a working version of gdb installed on your system. If you don't, you can also use Homebrew to install it: brew install gdb.

For debugging with VSCode:

  • cd into your local repo and open it in VSCode with code ..

  • Open the solution's .cpp source file in the editor.

  • Build it with Ctrl + Shift + B (this will build the current file with debug symbols present and compiler optimizations turned off).

  • Add a breakpoint and launch the debugger with F5.

    Note: If you'd like to build and debug the solutions independently, check the tasks.json file and make sure you pass the same args to the compiler when building.

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.