Documentation
¶
Overview ¶
Package wordsearch implements the word-finding grid puzzle.
Index ¶
- Variables
- func New(mode WordSearchMode, g grid, words []Word) (game.Gamer, error)
- type Direction
- 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 Position
- type Save
- type Word
- type WordSearchMode
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultKeyMap = KeyMap{ CursorKeyMap: game.DefaultCursorKeyMap, Select: key.NewBinding( key.WithKeys("enter", "space"), key.WithHelp("enter/space", "Select"), ), Cancel: key.NewBinding( key.WithKeys("backspace"), key.WithHelp("bkspc", "Cancel"), ), }
View Source
var Definition = puzzle.NewDefinition(puzzle.DefinitionSpec{ Name: "Word Search", Description: "Find the hidden words in a letter grid.", Aliases: []string{"words", "wordsearch", "ws"}, 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("Easy 10x10", "Find 6 words in a 10x10 grid.", 10, 10, 6, 3, 5, []Direction{Right, Down, DownRight}), NewMode("Medium 15x15", "Find 10 words in a 15x15 grid.", 15, 15, 10, 4, 7, []Direction{Right, Down, DownRight, DownLeft, Left, Up}), NewMode("Hard 20x20", "Find 15 words in a 20x20 grid.", 20, 20, 15, 5, 10, []Direction{Right, Down, DownRight, DownLeft, Left, Up, UpRight, UpLeft}), }
View Source
var PDFPrintAdapter = printAdapter{}
Functions ¶
Types ¶
type Direction ¶
type Direction int
Direction represents one of 8 possible directions a word can be placed
type Model ¶
type Model struct {
// contains filtered or unexported fields
}
func ImportModel ¶
func (Model) GetDebugInfo ¶
func (Model) GetFullHelp ¶
type Save ¶
type Save struct {
Width int `json:"width"`
Height int `json:"height"`
Grid string `json:"grid"`
Words []Word `json:"words"`
CursorX int `json:"cursor_x"`
CursorY int `json:"cursor_y"`
Selection int `json:"selection"`
SelectionX int `json:"selection_x"`
SelectionY int `json:"selection_y"`
Solved bool `json:"solved"`
}
type Word ¶
Word represents a hidden word in the puzzle
func GenerateWordSearch ¶
func GenerateWordSearchSeeded ¶ added in v1.3.0
type WordSearchMode ¶
type WordSearchMode struct {
game.BaseMode
Width int
Height int
WordCount int
MinWordLen int
MaxWordLen int
AllowedDirs []Direction
}
func NewMode ¶
func NewMode(title, description string, width, height, wordCount, minLen, maxLen int, allowedDirs []Direction) WordSearchMode
func (WordSearchMode) SpawnSeeded ¶ added in v1.3.0
Click to show internal directories.
Click to hide internal directories.
