Initial commit

This commit is contained in:
2026-07-17 22:35:11 +02:00
parent 3121a7d818
commit 1ff0efb557
31 changed files with 895046 additions and 0 deletions
+93
View File
@@ -0,0 +1,93 @@
package board
import "image/color"
// ────────────────────────────────────────────────────────────────────────────── //
// MARK STRUCTURE //
// ────────────────────────────────────────────────────────────────────────────── //
type Mark struct {
Cell *Cell
Change *Change
color color.Color
}
func (m *Mark) GetColor() color.Color {
return m.color
}
// ────────────────────────────────────────────────────────────────────────────── //
// CHANGE STRUCTURE //
// ────────────────────────────────────────────────────────────────────────────── //
type ChangeAction int
const (
ActionSetNumber = iota
ActionSetNote
ActionRemoveNumber
ActionRemoveNote
)
// ────────────────────────────────────────────────────────────────────────────── //
// CHANGE STRUCTURE //
// ────────────────────────────────────────────────────────────────────────────── //
type Change struct {
Cell *Cell
marks []Mark
action ChangeAction
value int
from int
triggerdBy string //strategy or manuell
}
// ────────────────────────────────────────────────────────────────────────────── //
// GETTER //
// ────────────────────────────────────────────────────────────────────────────── //
func (c *Change) GetMarks() []Mark {
return c.marks
}
func (c *Change) GetAction() ChangeAction {
return c.action
}
func (c *Change) GetTo() int {
return c.value
}
func (c *Change) GetFrom() int {
return c.from
}
func (c *Change) GetTriggeredBy() string {
return c.triggerdBy
}
// ────────────────────────────────────────────────────────────────────────────── //
// ??? //
// ────────────────────────────────────────────────────────────────────────────── //
func (c *Change) do() {
switch c.action {
case ActionSetNumber:
c.Cell.number = c.value
case ActionSetNote:
c.Cell.Notes.numbers = append(c.Cell.Notes.numbers, c.value)
case ActionRemoveNumber:
c.Cell.number = 0
case ActionRemoveNote:
for i, existing := range c.Cell.Notes.numbers {
if existing == c.from {
c.Cell.Notes.numbers = append(c.Cell.Notes.numbers[:i], c.Cell.Notes.numbers[i+1:]...)
return
}
}
}
}