rename sequences to cache

This commit is contained in:
onyx-and-iris 2024-12-22 16:57:19 +00:00
parent 287a168293
commit 4bed4a8563

View File

@ -19,7 +19,7 @@ func Solve(buf []byte) (int, error) {
conc := len(secrets)
done := make(chan bool)
sequences := newSequenceCache()
cache := newSequenceCache()
for _, secret := range secrets {
go func() {
seen := make(map[sequence]struct{})
@ -35,7 +35,7 @@ func Solve(buf []byte) (int, error) {
_, ok := seen[sequence]
if !ok {
seen[sequence] = struct{}{}
sequences.upsert(sequence, lastDigit(randomiser.Secret()))
cache.upsert(sequence, lastDigit(randomiser.Secret()))
}
}
done <- true
@ -47,7 +47,7 @@ func Solve(buf []byte) (int, error) {
}
max := 0
for _, sum := range sequences.data {
for _, sum := range cache.data {
if sum > max {
max = sum
}