mirror of
https://github.com/onyx-and-iris/aoc2024.git
synced 2025-01-09 06:10:47 +00:00
rename sequences to cache
This commit is contained in:
parent
287a168293
commit
4bed4a8563
@ -19,7 +19,7 @@ func Solve(buf []byte) (int, error) {
|
|||||||
conc := len(secrets)
|
conc := len(secrets)
|
||||||
done := make(chan bool)
|
done := make(chan bool)
|
||||||
|
|
||||||
sequences := newSequenceCache()
|
cache := newSequenceCache()
|
||||||
for _, secret := range secrets {
|
for _, secret := range secrets {
|
||||||
go func() {
|
go func() {
|
||||||
seen := make(map[sequence]struct{})
|
seen := make(map[sequence]struct{})
|
||||||
@ -35,7 +35,7 @@ func Solve(buf []byte) (int, error) {
|
|||||||
_, ok := seen[sequence]
|
_, ok := seen[sequence]
|
||||||
if !ok {
|
if !ok {
|
||||||
seen[sequence] = struct{}{}
|
seen[sequence] = struct{}{}
|
||||||
sequences.upsert(sequence, lastDigit(randomiser.Secret()))
|
cache.upsert(sequence, lastDigit(randomiser.Secret()))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
done <- true
|
done <- true
|
||||||
@ -47,7 +47,7 @@ func Solve(buf []byte) (int, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
max := 0
|
max := 0
|
||||||
for _, sum := range sequences.data {
|
for _, sum := range cache.data {
|
||||||
if sum > max {
|
if sum > max {
|
||||||
max = sum
|
max = sum
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user