Documentation
¶
Index ¶
- Variables
- func New(mode SpellPuzzleMode, puzzle GeneratedPuzzle) (game.Gamer, error)
- type GeneratedPuzzle
- 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 Orientation
- type Position
- type Save
- type SpellPuzzleMode
- type WordPlacement
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultKeyMap = KeyMap{ Left: key.NewBinding( key.WithKeys("left", "a", "h"), key.WithHelp("left", "Prev letter"), ), Right: key.NewBinding( key.WithKeys("right", "d", "l"), key.WithHelp("right", "Next letter"), ), Shuffle: key.NewBinding( key.WithKeys("1"), key.WithHelp("1", "Shuffle letters"), ), Submit: key.NewBinding( key.WithKeys("enter"), key.WithHelp("enter", "Submit word"), ), Back: key.NewBinding( key.WithKeys("backspace"), key.WithHelp("bkspc", "Delete"), ), }
View Source
var Definition = puzzle.NewDefinition(puzzle.DefinitionSpec{ Name: "Spell Puzzle", Description: "Connect letters to fill a crossword with bonus anagrams.", Aliases: []string{"spell", "spellpuzzle"}, Modes: ModeDefinitions, DailyModeIDs: puzzle.SelectModeIDsByIndex(ModeDefinitions, 0), })
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", "6 letters, 4 board words, gentle intro.", 6, 4, 3), NewMode("Easy", "7 letters, 6 board words, balanced start.", 7, 6, 4), NewMode("Medium", "8 letters, 8 board words, denser layout.", 8, 8, 6), NewMode("Hard", "9 letters, 9 board words, largest launch board.", 9, 9, 8), }
View Source
var PDFPrintAdapter = printAdapter{}
Functions ¶
func New ¶
func New(mode SpellPuzzleMode, puzzle GeneratedPuzzle) (game.Gamer, error)
Types ¶
type GeneratedPuzzle ¶
type GeneratedPuzzle struct {
Bank string
Placements []WordPlacement
BonusWords []string
AllowedWord []string
}
func GeneratePuzzle ¶
func GeneratePuzzle(mode SpellPuzzleMode) (GeneratedPuzzle, error)
func GeneratePuzzleSeeded ¶
func GeneratePuzzleSeeded(mode SpellPuzzleMode, rng *rand.Rand) (GeneratedPuzzle, error)
type Model ¶
type Model struct {
// contains filtered or unexported fields
}
func ImportModel ¶
func (Model) GetDebugInfo ¶
func (Model) GetFullHelp ¶
type Save ¶
type Save struct {
ModeTitle string `json:"mode_title"`
Bank string `json:"bank"`
BankColors []int `json:"bank_colors,omitempty"`
Placements []WordPlacement `json:"placements"`
BonusWords []string `json:"bonus_words"`
Trace []int `json:"trace"`
BankCursor int `json:"bank_cursor"`
Solved bool `json:"solved"`
Feedback feedback `json:"feedback"`
ShowFullHelp bool `json:"show_full_help"`
}
type SpellPuzzleMode ¶
func NewMode ¶
func NewMode(title, description string, bankSize, boardWords, minBonusWords int) SpellPuzzleMode
func (SpellPuzzleMode) SpawnSeeded ¶
type WordPlacement ¶
type WordPlacement struct {
Text string `json:"text"`
Start Position `json:"start"`
Orientation Orientation `json:"orientation"`
Found bool `json:"found"`
}
func (WordPlacement) Positions ¶
func (w WordPlacement) Positions() []Position
Click to show internal directories.
Click to hide internal directories.