package solver

import (
	"embed"
	"log"
	"strconv"
	"strings"
	"time"
)

// Dirty AF. Not happy with this. 😒
//
//go:embed blocks.csv
var f embed.FS

func (solver *Solver) load_blocks() {

	defer solver.timeTrack(time.Now(), "Loaded blocks")
	log.Println("Loading blocks")

	var blocks []int

	file, err := f.ReadFile("blocks.csv")
	if err != nil {
		panic(err)
	}

	temp := strings.Split(string(file), "\n")

	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)
	}

	solver.blocks = blocks

}