41 lines
625 B
Go
Raw Normal View History

package solver
import (
2025-01-23 23:39:57 +01:00
"embed"
"log"
"strconv"
2025-01-23 23:39:57 +01:00
"strings"
2025-01-23 20:26:43 +01:00
"time"
)
2025-01-23 23:39:57 +01:00
// Dirty AF. Not happy with this. 😒
//
//go:embed blocks.csv
var f embed.FS
func (solver *Solver) load_blocks() {
2025-01-23 20:26:43 +01:00
defer solver.timeTrack(time.Now(), "Loaded blocks")
log.Println("Loading blocks")
var blocks []int
2025-01-23 23:39:57 +01:00
file, err := f.ReadFile("blocks.csv")
if err != nil {
panic(err)
}
2025-01-23 23:39:57 +01:00
temp := strings.Split(string(file), "\n")
2025-01-23 23:39:57 +01:00
for _, line := range temp {
block, _ := strconv.Atoi(string(line))
if block == 0 { // Ignore new-line at the end of the file.
continue
}
blocks = append(blocks, block)
}
2025-01-23 23:39:57 +01:00
solver.blocks = blocks
2025-01-23 20:26:43 +01:00
}