Documentation
¶
Overview ¶
Package hitori implements the Hitori number puzzle game.
Index ¶
- Variables
- func Generate(size int, blackRatio float64) (grid, error)
- func GenerateSeeded(size int, blackRatio float64, rng *rand.Rand) (grid, error)
- func New(mode HitoriMode, numbers grid) (game.Gamer, error)
- type HitoriMode
- 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) Reset() game.Gamer
- 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
Constants ¶
This section is empty.
Variables ¶
var DailyModes = []list.Item{ Modes[1], Modes[2], }
DailyModes is the subset of Modes eligible for daily puzzle rotation.
var DefaultKeyMap = KeyMap{ CursorKeyMap: game.DefaultCursorKeyMap, ShadeCell: key.NewBinding( key.WithKeys("x"), key.WithHelp("x", "Shade"), ), CircleCell: key.NewBinding( key.WithKeys("z"), key.WithHelp("z", "Circle"), ), ClearCell: key.NewBinding( key.WithKeys("backspace", "delete"), key.WithHelp("bkspc", "Clear"), ), }
DefaultKeyMap provides the standard keybindings.
var HelpContent string
var Modes = []list.Item{ NewMode("Mini", "5\u00d75 grid, gentle introduction.", 5, 0.32), NewMode("Easy", "6\u00d76 grid, straightforward logic.", 6, 0.32), NewMode("Medium", "8\u00d78 grid, moderate challenge.", 8, 0.30), NewMode("Tricky", "9\u00d79 grid, requires careful deduction.", 9, 0.30), NewMode("Hard", "10\u00d710 grid, advanced logic chains.", 10, 0.30), NewMode("Expert", "12\u00d712 grid, maximum challenge.", 12, 0.28), }
Modes defines the available difficulty levels. Difficulty is controlled by grid size and the ratio of black cells. Smaller grids with fewer black cells are easier to deduce; larger grids with more black cells require deeper chains of logic.
Functions ¶
func Generate ¶
Generate creates a Hitori puzzle of the given size. Returns the puzzle numbers grid or an error if generation fails after all attempts.
func GenerateSeeded ¶
Types ¶
type HitoriMode ¶
HitoriMode represents a specific difficulty configuration for Hitori.
func NewMode ¶
func NewMode(title, desc string, size int, blackRatio float64) HitoriMode
NewMode creates a new Hitori game mode.
func (HitoriMode) Spawn ¶
func (h HitoriMode) Spawn() (game.Gamer, error)
Spawn creates a new game instance for this mode.
func (HitoriMode) SpawnSeeded ¶
type KeyMap ¶
type KeyMap struct {
game.CursorKeyMap
ShadeCell key.Binding
CircleCell key.Binding
ClearCell key.Binding
}
KeyMap defines the keybindings for Hitori.
type Model ¶
type Model struct {
// contains filtered or unexported fields
}
Model implements game.Gamer for Hitori.
func ImportModel ¶
ImportModel reconstructs a Model from saved JSON data.
func (Model) GetDebugInfo ¶
func (Model) GetFullHelp ¶
GetFullHelp implements game.Gamer.
