wordsearch

package
v0.0.0-...-5cc4ecd Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 9, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Core

type Core struct {
	Width      int        `json:"width"`      // Width of Core.Grid
	Height     int        `json:"height"`     // Height of Core.Grid
	WordsCount int        `json:"wordsCount"` // Total words count that hidden in Core.Grid
	Grid       [][]string `json:"grid"`       // Grid consisting of letters among which are hidden random words
	Words      []Word     `json:"words"`      // Words that are hidden in Core.Grid
}

Core struct of wordsearch module

func Generate

func Generate(w, h int) (Core, error)

Generate a new Core of a given width and heigth, corresponding to the size of the Core.Grid

type Word

type Word struct {
	Word     string       `json:"word"`     // Value of hidden word
	Position WordPosition `json:"position"` // Position of the hidden word in the Core.Grid
}

Random word with it's position in Core.Grid

type WordPosition

type WordPosition struct {
	Start [2]int `json:"start"` // Satrt position of the hidden word in the Core.Grid, which has the form of an array [x, y]
	End   [2]int `json:"end"`   // End position of the hidden word in the Core.Grid, which has the form of an array [x, y]
}

Start and end position on hidden word in the *Core.Grid*

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL