Initialize slices

This commit is contained in:
Madison Rye Progress
2026-03-18 14:15:38 -07:00
parent 4a3daa764d
commit 3f1053ea61
2 changed files with 7 additions and 1 deletions

View File

@ -68,10 +68,13 @@ func (s *State) historyStart() {
p, peek := s.historyPoint(peek) p, peek := s.historyPoint(peek)
s.sectionSize = p.X s.sectionSize = p.X
s.cellsPerSection = p.Y s.cellsPerSection = p.Y
s.cells = newField(s.sectionSize * s.cellsPerSection) s.cells = newField(s.size())
s.sections = newField(s.sectionSize) s.sections = newField(s.sectionSize)
s.cursor = &Point{0, 0} s.cursor = &Point{0, 0}
s.rowHeaders = make([]header, s.size())
s.colHeaders = make([]header, s.size())
s.historyIndex = peek s.historyIndex = peek
s.score.Blackout = make([]bool, s.size())
} }
func (s *State) historyInitSection() { func (s *State) historyInitSection() {

View File

@ -45,7 +45,10 @@ func New(sectionSize, cellsPerSection int) *State {
cells: newField(sectionSize * cellsPerSection), cells: newField(sectionSize * cellsPerSection),
sections: newField(sectionSize), sections: newField(sectionSize),
cursor: &Point{0, 0}, cursor: &Point{0, 0},
rowHeaders: make([]header, sectionSize*cellsPerSection),
colHeaders: make([]header, sectionSize*cellsPerSection),
} }
s.score.Blackout = make([]bool, sectionSize*cellsPerSection)
s.history = fmt.Sprintf("g(%d,%d)", sectionSize, cellsPerSection) s.history = fmt.Sprintf("g(%d,%d)", sectionSize, cellsPerSection)
for x := 0; x < sectionSize; x++ { for x := 0; x < sectionSize; x++ {
for y := 0; y < sectionSize; y++ { for y := 0; y < sectionSize; y++ {