Documentation
¶
Overview ¶
Package sudoku implements the classic number-placement puzzle.
Index ¶
- Variables
- func GenerateProvidedCells(m SudokuMode) []cell
- func GenerateProvidedCellsSeeded(m SudokuMode, rng *rand.Rand) []cell
- func New(mode SudokuMode, provided []cell) (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) IsProvidedCell() bool
- 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
- type SudokuMode
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultKeyMap = KeyMap{ CursorKeyMap: game.DefaultCursorKeyMap, FillValue: key.NewBinding( key.WithKeys("1", "2", "3", "4", "5", "6", "7", "8", "9"), key.WithHelp("1-9", "Fill"), ), ClearCell: key.NewBinding( key.WithKeys("backspace"), key.WithHelp("bkspc", "Clear"), ), }
View Source
var Definition = puzzle.NewDefinition(puzzle.DefinitionSpec{ Name: "Sudoku", Description: "Fill the 9x9 grid following sudoku rules.", 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("Beginner", "45–52 clues. Single Candidate / Scanning.", 45), NewMode("Easy", "38–44 clues. Naked Singles.", 38), NewMode("Medium", "32–37 clues. Hidden Pairs / Pointing.", 32), NewMode("Hard", "27–31 clues. Box-Line Reduction / Triples.", 27), NewMode("Expert", "22–26 clues. X-Wing / Y-Wing.", 22), NewMode("Diabolical", "17–21 clues. Swordfish / XY-Chains.", 17), }
View Source
var PDFPrintAdapter = printAdapter{}
Functions ¶
func GenerateProvidedCells ¶
func GenerateProvidedCells(m SudokuMode) []cell
GenerateProvidedCells generates a random sudoku puzzle with the number of provided cells determined by the mode's ProvidedCount.
func GenerateProvidedCellsSeeded ¶ added in v1.3.0
func GenerateProvidedCellsSeeded(m SudokuMode, rng *rand.Rand) []cell
Types ¶
type Model ¶
type Model struct {
// contains filtered or unexported fields
}
func ImportModel ¶
func (Model) GetDebugInfo ¶
func (Model) GetFullHelp ¶
func (Model) IsProvidedCell ¶
type SudokuMode ¶
func NewMode ¶
func NewMode(title, description string, providedCount int) SudokuMode
func (SudokuMode) SpawnSeeded ¶ added in v1.3.0
Click to show internal directories.
Click to hide internal directories.
