Documentation
¶
Index ¶
- func Calculate(state *GuessState) (err error)
- func ClearLetter(state *GuessState) (row int, col int, err error)
- func GetSize() (x int, y int)
- func GetTotalTries() int
- func GetWordLength() int
- func HandleLetter(letter rune, state *GuessState) (row int, col int, err error)
- type GuessState
- type LetterPosition
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Calculate ¶
func Calculate(state *GuessState) (err error)
calculate word on hitting enter 1. Enter is hit before word is complete 2. Enter is hit after word is complete
func ClearLetter ¶
func ClearLetter(state *GuessState) (row int, col int, err error)
clear word on backspace return row, col to clear the letter error if letter is not be cleared
func HandleLetter ¶
func HandleLetter(letter rune, state *GuessState) (row int, col int, err error)
handle incoming letter if the current word is not complete, append the letter and notify the ui that ui has to be updated if the current word is full, just ignore the incoming letters
Types ¶
type GuessState ¶ added in v1.0.0
type GuessState struct {
// active guess index
ActiveIndex int
// flag to indicate if word is guessed
IsOver bool
// flag to decide if the user has correctly guessed
IsSuccess bool
// valid final list
ValidList []string
// tried guesses
Tries [6]string
// wordle for the game
Wordle string
}
guess state
type LetterPosition ¶
type LetterPosition string
letter position related stuffs
const ( // letter is in correct position LetterPositionCorrect LetterPosition = "correct" // letter is NOT in correct position LetterPositionInCorrect LetterPosition = "incorrect" // letter is not in word LetterPositionMissing LetterPosition = "missing" // neutral state; we have not yet calculated letter position LetterPositionBlank LetterPosition = "blank" )
func FindLetterPosition ¶
func FindLetterPosition(wordle string, col int, letter string) (pos LetterPosition)
helper function to calculate letter color takes in index and letter we will compare the letter at specified index of the wordle returns LetterPosition
Click to show internal directories.
Click to hide internal directories.