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