| 12345678910111213141516171819202122232425262728293031323334353637383940 |
- package solver
- import (
- "embed"
- "log"
- "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(), "Loaded blocks")
- log.Println("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
- }
|