Skip to content

Just a repo for doing advent of code freshly (without looking at previous solutions) to train with GoLang

Notifications You must be signed in to change notification settings

stundzia/adventofcode

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Advent of Code Solutions

Just a repo holding solutions for various years and days of advent of code puzzles (https://adventofcode.com/) written in GoLang.

This repo contains packages named after years for the according AoC year and those packages have sub-packages for the days. So package 2019 (github.com/stundzia/adventofcode/2019) contains packages day1, day2, day3 etc. for the according puzzle day, e.g. github.com/stundzia/adventofcode/2019/day1 contains the solutions for the first day. The function that solves the first part is always called DoSilver (i.e. do the solution for the silver star part (part 1)) and DoGold (i.e. do the solution for the gold star part (part 2)).

Running a specific day involves editing main.go. You will find it has the following lines:

package main

import (
	"github.com/stundzia/adventofcode/2020/day1"
	"github.com/stundzia/adventofcode/utils"
)


func main() {
	utils.RunWithTimeMetricsAndPrintOutput(day1.DoSilver)
	utils.RunWithTimeMetricsAndPrintOutput(day1.DoGold)
}

So to run e.g. 2020s day 14 solutions you would need to change it to:

package main

import (
	"github.com/stundzia/adventofcode/2020/day14"
	"github.com/stundzia/adventofcode/utils"
)


func main() {
	utils.RunWithTimeMetricsAndPrintOutput(day14.DoSilver)
	utils.RunWithTimeMetricsAndPrintOutput(day14.DoGold)
}

Then just execute the following command in repo root:

go run main.go

And you should see output similar to this:

Solution is:  Solution: 793524
Solution took:  294.77µs
Solution is:  Solution: 61515678
Solution took:  3.714729ms

About

Just a repo for doing advent of code freshly (without looking at previous solutions) to train with GoLang

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages