Coder Social home page Coder Social logo

advent-of-code's Introduction

Advent of Code - Golang

https://adventofcode.com/

Advent of Code (credits: Eric Wastl) is an Advent calendar of small programming puzzles for a variety of skill sets and skill levels that can be solved in any programming language you like. People use them as interview prep, company training, university coursework, practice problems, a speed contest, or to challenge each other.

  • Language:
    • Golang (+ some Python for some days)
  • Years:
    • 2023

Requirements

  • Go >= 1.21
  • Python >= 3.8
  • graphviz (optional - for some days which required graph visualization)
go mod download
pip install -r requirements.txt

Run a specific solver

Warning

My input files are encrypted (cf Run tests section).

Please replace the input file with your own input file, or decrypt mine with git-crypt unlock.

$ cd {YEAH}/{DAY} && cat {INPUT_FILE} | go run main.go -part={PART}

Example for year 2023, day 1, part 1:

$ cd 2023/01 && cat input.txt | go run main.go -part=1

Run tests

This will run all solvers against sample data AND input data, and check expected results. The command will also run utils package tests.

Warning

  • The tests require all the input data to be present next to each solver, in a file named input.txt, e.g. 2023/day1/input.txt
  • My input files are included in the repo, but they're git-crypt encrypted (to be compliant with AoC rules, which forbid to share publicly input files).
  • For test cases that target input data: the expected results are the ones matching my own input data. If you want to run the tests against your own input data, you'll need to update the expected results in the test cases to match yours (same if the inputs has been rotated). Warning:

All tests

$ make test

Solvers only, for a specific year

$ go test ./2023/...

Run all solvers (gives a pretty overview of the results & timings)

Current year

$ make run-all

Specific year

$ go run cmd/run_all.go -path="." -year=2023

Run benchmarks

All benchmarks

$ make bench

Specific year

$ go test ./2023/... -bench=.

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.