From 5d62a4b611c59560082df396395d33a0c5932ce0 Mon Sep 17 00:00:00 2001 From: Caleb Denio Date: Thu, 24 Sep 2026 15:36:49 -0600 Subject: [PATCH] check word --- Makefile | 4 ++-- main.go => cmd/main.go | 0 game/game.go | 15 +++++++++++++++ 3 files changed, 17 insertions(+), 2 deletions(-) rename main.go => cmd/main.go (100%) diff --git a/Makefile b/Makefile index 5896c91..1bcfda0 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ all: bin/crossword bin/crossword-ssh -bin/crossword: main.go puz/puz.go game/game.go - go build -o $@ . +bin/crossword: cmd/main.go puz/puz.go game/game.go + go build -o $@ ./cmd bin/crossword-ssh: ssh/main.go puz/puz.go game/game.go go build -o $@ ./ssh diff --git a/main.go b/cmd/main.go similarity index 100% rename from main.go rename to cmd/main.go diff --git a/game/game.go b/game/game.go index 3dfb92c..b7982f5 100644 --- a/game/game.go +++ b/game/game.go @@ -226,6 +226,21 @@ func (state *State) CheckPuzzle() { state.CheckState = result } +func (state *State) CheckWord(clue *puz.Clue) { + for i, cellIdx := range clue.Cells { + cellState := state.PuzzleState[cellIdx] + if cellState == '-' || cellState == '.' { + continue + } + + if cellState == rune(clue.Solution[i]) { + state.CheckState[cellIdx] = 'y' + } else { + state.CheckState[cellIdx] = 'n' + } + } +} + func (state *State) RenderUI(w io.Writer) int { uiHeight := 0