chore: fixes
This commit is contained in:
parent
951c2c298a
commit
f8fa61672f
8
grids.go
8
grids.go
|
@ -2,7 +2,9 @@ package aoc
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"cmp"
|
"cmp"
|
||||||
|
"fmt"
|
||||||
"sort"
|
"sort"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"golang.org/x/exp/maps"
|
"golang.org/x/exp/maps"
|
||||||
)
|
)
|
||||||
|
@ -109,8 +111,8 @@ func (m *cmap[C, N]) String() string {
|
||||||
|
|
||||||
for k, nbs := range m.neighbors {
|
for k, nbs := range m.neighbors {
|
||||||
fmt.Fprintln(b, k)
|
fmt.Fprintln(b, k)
|
||||||
for to, v := range nbs {
|
for to, c := range nbs {
|
||||||
fmt.Fprintln(b, " ", to, k)
|
fmt.Fprintln(b, " ", to, c)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -136,7 +138,7 @@ func CompressMap[C number, N comparable](p pather[C, N], start N) pather[C, N] {
|
||||||
to[b] = to[n] + p.Cost(n, b)
|
to[b] = to[n] + p.Cost(n, b)
|
||||||
delete(to, n)
|
delete(to, n)
|
||||||
visited[a] = to
|
visited[a] = to
|
||||||
} else if to, ok := visited[b]; ok {
|
} else if to, ok := visited[b]; ok {
|
||||||
to[a] = to[n] + p.Cost(n, a)
|
to[a] = to[n] + p.Cost(n, a)
|
||||||
delete(to, n)
|
delete(to, n)
|
||||||
visited[b] = to
|
visited[b] = to
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
package aoc_test
|
package aoc_test
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
|
||||||
"sort"
|
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/matryer/is"
|
"github.com/matryer/is"
|
||||||
|
@ -27,7 +25,6 @@ func TestRepeat(t *testing.T) {
|
||||||
is.Equal(aoc.Repeat(5, 3), []int{5, 5, 5})
|
is.Equal(aoc.Repeat(5, 3), []int{5, 5, 5})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
func TestTranspose(t *testing.T) {
|
func TestTranspose(t *testing.T) {
|
||||||
is := is.New(t)
|
is := is.New(t)
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,11 @@
|
||||||
package aoc_test
|
package aoc_test
|
||||||
|
|
||||||
|
import (
|
||||||
|
"testing"
|
||||||
|
|
||||||
|
"github.com/matryer/is"
|
||||||
|
aoc "go.sour.is/advent-of-code"
|
||||||
|
)
|
||||||
|
|
||||||
func TestLCM(t *testing.T) {
|
func TestLCM(t *testing.T) {
|
||||||
is := is.New(t)
|
is := is.New(t)
|
||||||
|
|
|
@ -1,5 +1,12 @@
|
||||||
package aoc_test
|
package aoc_test
|
||||||
|
|
||||||
|
import (
|
||||||
|
"sort"
|
||||||
|
"testing"
|
||||||
|
|
||||||
|
"github.com/matryer/is"
|
||||||
|
aoc "go.sour.is/advent-of-code"
|
||||||
|
)
|
||||||
|
|
||||||
func TestSet(t *testing.T) {
|
func TestSet(t *testing.T) {
|
||||||
is := is.New(t)
|
is := is.New(t)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user