Skip to content

Commit

Permalink
resolve 2023
Browse files Browse the repository at this point in the history
  • Loading branch information
dbut2 committed Dec 3, 2024
1 parent b003628 commit 799d61a
Show file tree
Hide file tree
Showing 40 changed files with 86 additions and 96 deletions.
1 change: 1 addition & 0 deletions .github/workflows/quality.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,5 @@ jobs:

- name: Build all Go files
run: |
find ./2023 -name "*.go" -exec go build {} \;
find ./2024 -name "*.go" -exec go build {} \;
4 changes: 2 additions & 2 deletions 2023/01/01.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ var tests embed.FS

func main() {
h := harness.New(solve, input, tests)
h.Expect(1, 142)
h.Solve()
h.Tester.Expect(1, 142)
h.Run()
}

func solve(input string) int {
Expand Down
4 changes: 2 additions & 2 deletions 2023/01/02.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ var tests embed.FS

func main() {
h := harness.New(solve, input, tests)
h.Expect(2, 281)
h.Solve()
h.Tester.Expect(2, 281)
h.Run()
}

func solve(input string) int {
Expand Down
4 changes: 2 additions & 2 deletions 2023/07/01.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ var tests embed.FS

func main() {
h := harness.New(solve, input, tests)
h.Expect(1, 6440)
h.Solve()
h.Tester.Expect(1, 6440)
h.Run()
}

func solve(input string) int {
Expand Down
4 changes: 2 additions & 2 deletions 2023/07/02.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ var tests embed.FS

func main() {
h := harness.New(solve, input, tests)
h.Expect(2, 5905)
h.Solve()
h.Tester.Expect(2, 5905)
h.Run()
}

func solve(input string) int {
Expand Down
4 changes: 2 additions & 2 deletions 2023/08/01.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ var tests embed.FS

func main() {
h := harness.New(solve, input, tests)
h.Expect(1, 2)
h.Solve()
h.Tester.Expect(1, 2)
h.Run()
}

func solve(input string) int {
Expand Down
4 changes: 2 additions & 2 deletions 2023/08/02.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ var tests embed.FS

func main() {
h := harness.New(solve, input, tests)
h.Expect(2, 6)
h.Solve()
h.Tester.Expect(2, 6)
h.Run()
}

type node struct {
Expand Down
4 changes: 2 additions & 2 deletions 2023/09/01.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ var tests embed.FS

func main() {
h := harness.New(solve, input, tests)
h.Expect(1, 114)
h.Solve()
h.Tester.Expect(1, 114)
h.Run()
}

func solve(input string) int {
Expand Down
4 changes: 2 additions & 2 deletions 2023/09/02.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ var tests embed.FS

func main() {
h := harness.New(solve, input, tests)
h.Expect(1, 2)
h.Solve()
h.Tester.Expect(1, 2)
h.Run()
}

func solve(input string) int {
Expand Down
11 changes: 5 additions & 6 deletions 2023/10/01.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ var tests embed.FS

func main() {
h := harness.New(solve, input, tests)
h.Expect(1, 8)
h.Solve()
h.Tester.Expect(1, 8)
h.Run()
}

const (
Expand Down Expand Up @@ -82,11 +82,10 @@ func solve(input string) int {

seen := sets.SetOf(start)
loop := []space.Cell{start}
queue := lists.Queue[space.Cell]{start.Move(connectionDirections[*grid.Get(start)][0])}

for len(queue) > 0 {
cell := queue.Pop()
queue := lists.Queue[space.Cell]{}
queue.Push(start.Move(connectionDirections[*grid.Get(start)][0]))

for cell := range queue.Seq {
if seen.Contains(cell) {
continue
}
Expand Down
11 changes: 5 additions & 6 deletions 2023/10/02.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ var tests embed.FS

func main() {
h := harness.New(solve, input, tests)
h.Expect(2, 10)
h.Solve()
h.Tester.Expect(2, 10)
h.Run()
}

const (
Expand Down Expand Up @@ -83,11 +83,10 @@ func solve(input string) int {

seen := sets.SetOf(start)
loop := []space.Cell{start}
queue := lists.Queue[space.Cell]{start.Move(connectionDirections[*grid.Get(start)][0])}

for len(queue) > 0 {
cell := queue.Pop()
queue := lists.Queue[space.Cell]{}
queue.Push(start.Move(connectionDirections[*grid.Get(start)][0]))

for cell := range queue.Seq {
if seen.Contains(cell) {
continue
}
Expand Down
4 changes: 2 additions & 2 deletions 2023/11/01.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ var tests embed.FS

func main() {
h := harness.New(solve, input, tests)
h.Expect(1, 374)
h.Solve()
h.Tester.Expect(1, 374)
h.Run()
}

func solve(input string) int {
Expand Down
2 changes: 1 addition & 1 deletion 2023/11/02.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ var tests embed.FS
func main() {
h := harness.New(solve, input, tests)
//h.Expect(1, 0)
h.Solve()
h.Run()
}

func solve(input string) int {
Expand Down
4 changes: 2 additions & 2 deletions 2023/12/01.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ var tests embed.FS

func main() {
h := harness.New(solve, input, tests)
h.Expect(1, 21)
h.Solve()
h.Tester.Expect(1, 21)
h.Run()
}

func solve(input string) int {
Expand Down
4 changes: 2 additions & 2 deletions 2023/12/02.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ var tests embed.FS

func main() {
h := harness.New(solve, input, tests)
h.Expect(1, 525152)
h.Solve()
h.Tester.Expect(1, 525152)
h.Run()
}

func solve(input string) int {
Expand Down
4 changes: 2 additions & 2 deletions 2023/13/01.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ var tests embed.FS

func main() {
h := harness.New(solve, input, tests)
h.Expect(1, 405)
h.Solve()
h.Tester.Expect(1, 405)
h.Run()
}

func solve(input string) int {
Expand Down
5 changes: 3 additions & 2 deletions 2023/13/02.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package main

import (
"embed"

"github.com/dbut2/advent-of-code/pkg/grid"
"github.com/dbut2/advent-of-code/pkg/harness"
"github.com/dbut2/advent-of-code/pkg/utils"
Expand All @@ -15,8 +16,8 @@ var tests embed.FS

func main() {
h := harness.New(solve, input, tests)
h.Expect(2, 400)
h.Solve()
h.Tester.Expect(2, 400)
h.Run()
}

func solve(input string) int {
Expand Down
4 changes: 2 additions & 2 deletions 2023/14/01.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ var tests embed.FS

func main() {
h := harness.New(solve, input, tests)
h.Expect(1, 136)
h.Solve()
h.Tester.Expect(1, 136)
h.Run()
}

func solve(input string) int {
Expand Down
4 changes: 2 additions & 2 deletions 2023/14/02.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ var tests embed.FS

func main() {
h := harness.New(solve, input, tests)
h.Expect(1, 64)
h.Solve()
h.Tester.Expect(1, 64)
h.Run()
}

type rock uint8
Expand Down
4 changes: 2 additions & 2 deletions 2023/15/01.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ var tests embed.FS

func main() {
h := harness.New(solve, input, tests)
h.Expect(1, 1320)
h.Solve()
h.Tester.Expect(1, 1320)
h.Run()
}

func solve(input string) int {
Expand Down
4 changes: 2 additions & 2 deletions 2023/15/02.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ var tests embed.FS

func main() {
h := harness.New(solve, input, tests)
h.Expect(1, 145)
h.Solve()
h.Tester.Expect(1, 145)
h.Run()
}

func solve(input string) int {
Expand Down
4 changes: 2 additions & 2 deletions 2023/16/01.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ var tests embed.FS

func main() {
h := harness.New(solve, input, tests)
h.Expect(1, 46)
h.Solve()
h.Tester.Expect(1, 46)
h.Run()
}

func solve(input string) int {
Expand Down
4 changes: 2 additions & 2 deletions 2023/16/02.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ var tests embed.FS

func main() {
h := harness.New(solve, input, tests)
h.Expect(1, 51)
h.Solve()
h.Tester.Expect(1, 51)
h.Run()
}

func solve(input string) int {
Expand Down
4 changes: 2 additions & 2 deletions 2023/17/01.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ var tests embed.FS

func main() {
h := harness.New(solve, input, tests)
h.Expect(1, 102)
h.Solve()
h.Tester.Expect(1, 102)
h.Run()
}

func solve(input string) int {
Expand Down
6 changes: 3 additions & 3 deletions 2023/17/02.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ var tests embed.FS

func main() {
h := harness.New(solve, input, tests)
h.Expect(1, 94)
h.Expect(2, 71)
h.Solve()
h.Tester.Expect(1, 94)
h.Tester.Expect(2, 71)
h.Run()
}

func solve(input string) int {
Expand Down
4 changes: 2 additions & 2 deletions 2023/18/01.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ var tests embed.FS

func main() {
h := harness.New(solve, input, tests)
h.Expect(1, 62)
h.Solve()
h.Tester.Expect(1, 62)
h.Run()
}

func solve(input string) int {
Expand Down
4 changes: 2 additions & 2 deletions 2023/18/02.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ var tests embed.FS

func main() {
h := harness.New(solve, input, tests)
h.Expect(1, 952408144115)
h.Solve()
h.Tester.Expect(1, 952408144115)
h.Run()
}

func hexToDec(hex string) int {
Expand Down
4 changes: 2 additions & 2 deletions 2023/19/01.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ var tests embed.FS

func main() {
h := harness.New(solve, input, tests)
h.Expect(1, 19114)
h.Solve()
h.Tester.Expect(1, 19114)
h.Run()
}

type Workflow struct {
Expand Down
8 changes: 3 additions & 5 deletions 2023/19/02.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ var tests embed.FS

func main() {
h := harness.New(solve, input, tests)
h.Expect(1, 167409079868000)
h.Solve()
h.Tester.Expect(1, 167409079868000)
h.Run()
}

type Workflow struct {
Expand Down Expand Up @@ -100,9 +100,7 @@ func solve(input string) int {
rule: "in",
})

for len(queue) > 0 {
item := queue.Pop()

for item := range queue.Seq {
w := workflows[item.rule]

for _, rule := range w.Rules {
Expand Down
8 changes: 3 additions & 5 deletions 2023/20/01.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ var tests embed.FS

func main() {
h := harness.New(solve, input, tests)
h.Expect(1, 32000000)
h.Solve()
h.Tester.Expect(1, 32000000)
h.Run()
}

type Pulse struct {
Expand Down Expand Up @@ -167,9 +167,7 @@ func solve(input string) int {
high: false,
})

for len(pulses) > 0 {
p := pulses.Pop()

for p := range pulses.Seq {
if p.high {
high++
} else {
Expand Down
Loading

0 comments on commit 799d61a

Please sign in to comment.