From 1c580b5f9f709960adaeeae9b6bd4dd25966b29e Mon Sep 17 00:00:00 2001 From: Caleb Denio Date: Sun, 4 Oct 2026 14:05:15 -0600 Subject: [PATCH] improvement --- game/game.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/game/game.go b/game/game.go index 743bc94..2775c18 100644 --- a/game/game.go +++ b/game/game.go @@ -172,6 +172,8 @@ func (state *State) NextWord() { return } + puzzleFilled := state.GridFilled() + foundSelectedClue := false for _, clue := range state.Puzzle.Clues { @@ -180,7 +182,7 @@ func (state *State) NextWord() { continue } - if foundSelectedClue && clue.Direction == state.SelectedClue.Direction && !state.ClueFilled(clue) { + if foundSelectedClue && clue.Direction == state.SelectedClue.Direction && (puzzleFilled || !state.ClueFilled(clue)) { state.SelectedClue = clue state.SelectedCell = state.FirstUnfilledCellForClue(clue) return @@ -188,7 +190,7 @@ func (state *State) NextWord() { } for _, clue := range state.Puzzle.Clues { - if clue.Direction != state.SelectedClue.Direction && !state.ClueFilled(clue) { + if clue.Direction != state.SelectedClue.Direction && (puzzleFilled || !state.ClueFilled(clue)) { state.SelectedClue = clue state.SelectedCell = state.FirstUnfilledCellForClue(clue) return @@ -198,7 +200,7 @@ func (state *State) NextWord() { for _, clue := range state.Puzzle.Clues { if clue == state.SelectedClue { return - } else if clue.Direction == state.SelectedClue.Direction && !state.ClueFilled(clue) { + } else if clue.Direction == state.SelectedClue.Direction && (puzzleFilled || !state.ClueFilled(clue)) { state.SelectedClue = clue state.SelectedCell = state.FirstUnfilledCellForClue(clue) return