Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# This workflow will build a golang project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go

name: Go

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

jobs:

build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.23'

- name: Test
run: go test -v -cover ./src/...
3 changes: 0 additions & 3 deletions day1/go.mod

This file was deleted.

3 changes: 0 additions & 3 deletions day2/go.mod

This file was deleted.

3 changes: 0 additions & 3 deletions day3/go.mod

This file was deleted.

3 changes: 0 additions & 3 deletions day4/go.mod

This file was deleted.

3 changes: 0 additions & 3 deletions day5/go.mod

This file was deleted.

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
3 changes: 3 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module github.com/truggeri/adventofcode2024

go 1.23.4
13 changes: 1 addition & 12 deletions day1/main.go → src/day1/day1.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package main
package day1

import (
"fmt"
"slices"
"strconv"
"strings"
Expand All @@ -10,16 +9,6 @@ import (
// This is a bit fragile, but the spec doesn't indicate it will ever change
const INPUT_SEPARATOR = " "

func main() {
input := `3 4
4 3
2 5
1 3
3 9
3 3`
fmt.Println(solve(parseInput(input)))
}

func Solve(input string) uint {
return solve(parseInput(input))
}
Expand Down
2 changes: 1 addition & 1 deletion day1/main_test.go → src/day1/day1_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package main
package day1

import (
"testing"
Expand Down
14 changes: 1 addition & 13 deletions day2/main.go → src/day2/day2.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package main
package day2

import (
"fmt"
"slices"
"strconv"
"strings"
Expand All @@ -13,17 +12,6 @@ const DELTA_MIN = 1
type level uint
type report []level

func main() {
input := `7 6 4 2 1
1 2 7 8 9
9 7 6 2 1
1 3 2 4 5
8 6 4 4 1
1 3 6 7 9`
solution := Solve(input)
fmt.Println("Solution:", solution)
}

func Solve(input string) uint {
return solve(parseInput(input))
}
Expand Down
2 changes: 1 addition & 1 deletion day2/main_test.go → src/day2/day2_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package main
package day2

import (
"testing"
Expand Down
8 changes: 1 addition & 7 deletions day3/main.go → src/day3/day3.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package main
package day3

import (
"fmt"
"regexp"
"slices"
"strconv"
Expand All @@ -20,11 +19,6 @@ func (m mul) Eval() uint {
return m.x * m.y
}

func main() {
input := "xmul(2,4)%&mul[3,7]!@^do_not_mul(5,5)+mul(32,64]then(mul(11,8)mul(8,5))"
fmt.Println("Solution:", Solve(input))
}

func Solve(input string) uint {
return accumulate(parseInput(input))
}
Expand Down
2 changes: 1 addition & 1 deletion day3/main_test.go → src/day3/day3_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package main
package day3

import (
"testing"
Expand Down
17 changes: 1 addition & 16 deletions day4/main.go → src/day4/day4.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package main
package day4

import (
"fmt"
"slices"
"strings"
"unicode/utf8"
Expand All @@ -11,20 +10,6 @@ const WORD_TO_FIND = "XMAS"

var _rows []string

func main() {
input := `MMMSXXMASM
MSAMXMSMSA
AMXSXMAAMM
MSAMASMSMX
XMASAMXAMM
XXAMMXXAMA
SMSMSASXSS
SAXAMASAAA
MAMMMXMMMM
MXMXAXMASX`
fmt.Println("Solution:", Solve(input))
}

func Solve(input string) uint {
_rows = make([]string, 0)
return matchesByStrategy(input, rows) + matchesByStrategy(input, columns) + matchesByStrategy(input, diagonals)
Expand Down
2 changes: 1 addition & 1 deletion day4/main_test.go → src/day4/day4_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package main
package day4

import (
"testing"
Expand Down
33 changes: 0 additions & 33 deletions day5/main.go → src/day5/day5.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package main

import (
"fmt"
"slices"
"strconv"
"strings"
Expand All @@ -11,38 +10,6 @@ type pageNumber uint
type rule pageNumber
type batch []pageNumber

func main() {
input := `47|53
97|13
97|61
97|47
75|29
61|13
75|53
29|13
97|29
53|29
61|53
97|53
61|29
47|13
75|47
97|75
47|61
75|61
47|29
75|13
53|13

75,47,61,53,29
97,61,53,29,13
75,29,13
75,97,47,61,53
61,13,29
97,13,75,29,47`
fmt.Println("Solution:", Solve(input))
}

func Solve(input string) uint {
rules, batches := parseInput(input)
var count uint = 0
Expand Down
File renamed without changes.
Loading