Documentation ¶
Index ¶
- Variables
- func ClearTerminal()
- func ComposeWordleVisualWord(word string, target *model.Word) string
- func GetSaltsFromWord(word *model.Word) []string
- func IsGuessSuccess(result []bool) bool
- func IsLetter(s string) bool
- type HeaderRequest
- type HeaderResponse
- type Service
- func (s *Service) Guess(ctx context.Context, guess, proposal string) error
- func (s *Service) Guesses(ctx context.Context) (<-chan *model.Header, error)
- func (s *Service) Head(ctx context.Context) (*model.Header, error)
- func (s *Service) SetLog(log func(string))
- func (s *Service) Start(ctx context.Context) (err error)
- func (s *Service) Stop(context.Context) error
- type Store
- type TerminalManager
- type WordGame
- type WordleUI
Constants ¶
This section is empty.
Variables ¶
View Source
var Green = "green" // "\033[32m"
var Reset = "\033[0m" var Red = "\033[31m"
View Source
var MaxApptemps int = 5
View Source
var MaxWordLen int = 25
View Source
var MinWordLen int = 3
View Source
var Yellow = "yellow" // "\033[33m"
Functions ¶
func ClearTerminal ¶
func ClearTerminal()
func GetSaltsFromWord ¶
func IsGuessSuccess ¶
Types ¶
type HeaderRequest ¶
type HeaderRequest struct {
Height int // 0 means give me the latest
}
func (*HeaderRequest) Size ¶
func (h *HeaderRequest) Size() int
func (*HeaderRequest) Unmarshal ¶
func (h *HeaderRequest) Unmarshal(bytes []byte) error
type HeaderResponse ¶
func (*HeaderResponse) Size ¶
func (h *HeaderResponse) Size() int
func (*HeaderResponse) Unmarshal ¶
func (h *HeaderResponse) Unmarshal(bytes []byte) error
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func NewService ¶
type TerminalManager ¶
type TerminalManager struct { Game *WordGame OthersGuessC chan struct{} // contains filtered or unexported fields }
TerminalManager is a Text User Interface (TUI) for a ChatRoom. The Run method will draw the UI to the terminal in "fullscreen" mode. You can quit with Ctrl-C, or by typing "/quit" into the chat prompt.
func NewTerminalManager ¶
func NewTerminalManager(ctx context.Context, game *WordGame) *TerminalManager
NewTerminalManager returns a new TerminalManager struct that controls the text UI. It won't actually do anything until you call Run().
func (*TerminalManager) AddDebugItem ¶
func (ui *TerminalManager) AddDebugItem(s string)
func (*TerminalManager) Run ¶
func (ui *TerminalManager) Run() error
type WordGame ¶
type WordGame struct { PeerId string // to verify if the guess is correct Target *model.Word Salts []string StateIdx int32 NextWord string AttemptedWords []string // contains filtered or unexported fields }
func NewWordGame ¶
func NewWordGame(ctx context.Context, peerId string, proposerId string, target *model.Word, serv *Service) *WordGame
generate new game session
func (*WordGame) ComposeStateUI ¶
func (*WordGame) NewStdinInput ¶
func (*WordGame) WasGuessed ¶
Click to show internal directories.
Click to hide internal directories.