40 lines
674 B
Go
40 lines
674 B
Go
package solver
|
|
|
|
import (
|
|
"embed"
|
|
"strings"
|
|
"time"
|
|
)
|
|
|
|
// Dirty AF. Not happy with this. 😒
|
|
//
|
|
//go:embed blocks.csv
|
|
var f embed.FS
|
|
|
|
// Load all possible blocks from CSV in to memory
|
|
func (solver *Solver) LoadBlocks() {
|
|
|
|
defer solver.timeTrack(time.Now(), "Done!")
|
|
solver.Outp.Printf("Loading blocks... ")
|
|
|
|
var blocks []string
|
|
|
|
file, err := f.ReadFile("blocks.csv")
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
|
|
temp := strings.Split(string(file), "\n")
|
|
|
|
for _, line := range temp {
|
|
block := string(line)
|
|
if block == "\n" || block == "" { // Ignore new-line at the end of the file.
|
|
continue
|
|
}
|
|
blocks = append(blocks, block)
|
|
}
|
|
|
|
solver.Controller.Blocks = blocks
|
|
|
|
}
|