Initial commit: it compiles?

This commit is contained in:
Madison Rye Progress
2025-08-25 23:02:06 -07:00
parent 9ab2fb22fb
commit 82e7f3b393
9 changed files with 408 additions and 0 deletions

30
model/section.go Normal file
View File

@ -0,0 +1,30 @@
package model
import "math/rand"
func (m Model) randomizeSection(s int) Model {
m = m.clearSection(s)
for y := 0; y < m.section; y++ {
for x := 0; x < m.section; x++ {
cell := ((s/m.section)*m.size + y) + ((s%m.size)*m.section + x)
if rand.Int()%2 == 1 {
m.field |= cell
}
}
}
return m
}
func (m Model) clearSection(s int) Model {
m.sections = m.sections &^ s
for y := 0; y < m.section; y++ {
for x := 0; x < m.section; x++ {
cell := ((s/m.section)*m.size + y) + ((s%m.size)*m.section + x)
m.field = m.field &^ cell
m.marks = m.marks &^ cell
m.flags = m.flags &^ cell
m.correct = m.correct &^ cell
}
}
return m
}