Documentation
¶
Overview ¶
Package takuzu implements the binary (Binairo) puzzle game.
Index ¶
- Variables
- func New(mode TakuzuMode, puzzle grid, provided [][]bool) (game.Gamer, error)
- type KeyMap
- type Model
- func (m Model) GetDebugInfo() string
- func (m Model) GetFullHelp() [][]key.Binding
- func (m Model) GetSave() ([]byte, error)
- func (m Model) Init() tea.Cmd
- func (m Model) IsSolved() bool
- func (m Model) SetTitle(t string) game.Gamer
- func (m Model) Update(msg tea.Msg) (game.Gamer, tea.Cmd)
- func (m Model) View() string
- type Save
- type TakuzuMode
Constants ¶
This section is empty.
Variables ¶
var DefaultKeyMap = KeyMap{ CursorKeyMap: game.DefaultCursorKeyMap, PlaceZero: key.NewBinding( key.WithKeys("z", "0"), key.WithHelp("z/0", "Place ●"), ), PlaceOne: key.NewBinding( key.WithKeys("x", "1"), key.WithHelp("x/1", "Place ○"), ), Clear: key.NewBinding( key.WithKeys("backspace", "delete"), key.WithHelp("bkspc", "Clear"), ), }
DefaultKeyMap provides the standard keybindings.
var Modes = []list.Item{ NewMode("Beginner", "6×6 grid, ~50% clues. Doubles and sandwich patterns.", 6, 0.50), NewMode("Easy", "6×6 grid, ~40% clues. Counting required.", 6, 0.40), NewMode("Medium", "8×8 grid, ~40% clues. Larger grid, moderate deduction.", 8, 0.40), NewMode("Tricky", "10×10 grid, ~38% clues. Uniqueness rule needed.", 10, 0.38), NewMode("Hard", "10×10 grid, ~32% clues. Long deduction chains.", 10, 0.32), NewMode("Very Hard", "12×12 grid, ~30% clues. Deep logic required.", 12, 0.30), NewMode("Extreme", "14×14 grid, ~28% clues. Maximum challenge.", 14, 0.28), }
Modes defines the available difficulty levels. Difficulty is controlled by two axes: grid size and clue density. Smaller grids with more clues need only basic pattern recognition (doubles, sandwich patterns). Larger grids with fewer clues require counting, uniqueness elimination, and deeper chains of deduction.
Functions ¶
Types ¶
type KeyMap ¶
type KeyMap struct {
game.CursorKeyMap
PlaceZero key.Binding
PlaceOne key.Binding
Clear key.Binding
}
KeyMap defines the keybindings for Takuzu.
type Model ¶
type Model struct {
// contains filtered or unexported fields
}
Model implements game.Gamer for Takuzu.
func ImportModel ¶
ImportModel reconstructs a Model from saved JSON data.
func (Model) GetDebugInfo ¶
func (Model) GetFullHelp ¶
GetFullHelp implements game.Gamer.
type Save ¶
type Save struct {
Size int `json:"size"`
State string `json:"state"`
Provided string `json:"provided"`
ModeTitle string `json:"mode_title"`
}
Save represents the serialized state of a Takuzu game.
type TakuzuMode ¶
TakuzuMode represents a specific difficulty configuration for Takuzu.
