Documentation
¶
Index ¶
- Variables
- func New(mode NurikabeMode, puzzle Puzzle) (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) 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 NurikabeMode
- type Puzzle
- func Generate(mode NurikabeMode) (Puzzle, error)
- func GenerateSeeded(mode NurikabeMode, rng *rand.Rand) (Puzzle, error)
- func GenerateSeededWithContext(ctx context.Context, mode NurikabeMode, rng *rand.Rand) (Puzzle, error)
- func GenerateWithContext(ctx context.Context, mode NurikabeMode) (Puzzle, error)
- type Save
- type SolveStats
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultKeyMap = KeyMap{ CursorKeyMap: game.DefaultCursorKeyMap, SetSea: key.NewBinding( key.WithKeys("x"), key.WithHelp("x", "Sea"), ), SetIsland: key.NewBinding( key.WithKeys("z"), key.WithHelp("z", "Island"), ), Clear: key.NewBinding( key.WithKeys("backspace", "delete"), key.WithHelp("bkspc", "Clear"), ), }
View Source
var Definition = puzzle.NewDefinition(puzzle.DefinitionSpec{ Name: "Nurikabe", Description: "Split the land while keeping one connected sea.", Aliases: []string{"islands", "sea"}, Modes: ModeDefinitions, DailyModeIDs: puzzle.SelectModeIDsByIndex(ModeDefinitions, 1, 2), })
View Source
var Entry = gameentry.NewEntry(gameentry.EntrySpec{ Definition: Definition, Help: HelpContent, Import: game.AdaptImport(ImportModel), Modes: Modes, Print: PDFPrintAdapter, })
View Source
var HelpContent string
View Source
var ModeDefinitions = gameentry.BuildModeDefs(Modes)
View Source
var Modes = []game.Mode{ NewMode("Mini", "5x5 grid, gentle introduction.", 5, 5, 0.28, 5), NewMode("Easy", "7x7 grid, balanced logic.", 7, 7, 0.24, 7), NewMode("Medium", "9x9 grid, moderate deduction.", 9, 9, 0.20, 9), NewMode("Hard", "11x11 grid, lower clue density.", 11, 11, 0.16, 11), NewMode("Expert", "12x12 grid, sparse clues and long chains.", 12, 12, 0.14, 12), }
View Source
var PDFPrintAdapter = printAdapter{}
Functions ¶
Types ¶
type Model ¶
type Model struct {
// contains filtered or unexported fields
}
func ImportModel ¶
func (Model) GetDebugInfo ¶
func (Model) GetFullHelp ¶
type NurikabeMode ¶
type NurikabeMode struct {
game.BaseMode
Width int
Height int
ClueDensity float64
MaxIslandSize int
}
func NewMode ¶
func NewMode(title, desc string, width, height int, clueDensity float64, maxIslandSize int) NurikabeMode
func (NurikabeMode) SpawnContext ¶
func (NurikabeMode) SpawnSeeded ¶
func (NurikabeMode) SpawnSeededContext ¶
type Puzzle ¶
type Puzzle struct {
Width, Height int
Clues clueGrid
}
func Generate ¶
func Generate(mode NurikabeMode) (Puzzle, error)
func GenerateSeeded ¶
func GenerateSeeded(mode NurikabeMode, rng *rand.Rand) (Puzzle, error)
func GenerateWithContext ¶
func GenerateWithContext(ctx context.Context, mode NurikabeMode) (Puzzle, error)
type SolveStats ¶
func CountSolutions ¶
func CountSolutions(puzzle Puzzle, limit, nodeLimit int) (int, SolveStats, error)
func CountSolutionsContext ¶
Click to show internal directories.
Click to hide internal directories.