mirror of
https://github.com/cjdenio/crossword.git
synced 2026-12-01 03:26:19 +00:00
improvement
This commit is contained in:
1 file changed
+5
-3
+5
-3
@@ -172,6 +172,8 @@ func (state *State) NextWord() {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
puzzleFilled := state.GridFilled()
|
||||||
|
|
||||||
foundSelectedClue := false
|
foundSelectedClue := false
|
||||||
|
|
||||||
for _, clue := range state.Puzzle.Clues {
|
for _, clue := range state.Puzzle.Clues {
|
||||||
@@ -180,7 +182,7 @@ func (state *State) NextWord() {
|
|||||||
continue
|
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.SelectedClue = clue
|
||||||
state.SelectedCell = state.FirstUnfilledCellForClue(clue)
|
state.SelectedCell = state.FirstUnfilledCellForClue(clue)
|
||||||
return
|
return
|
||||||
@@ -188,7 +190,7 @@ func (state *State) NextWord() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, clue := range state.Puzzle.Clues {
|
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.SelectedClue = clue
|
||||||
state.SelectedCell = state.FirstUnfilledCellForClue(clue)
|
state.SelectedCell = state.FirstUnfilledCellForClue(clue)
|
||||||
return
|
return
|
||||||
@@ -198,7 +200,7 @@ func (state *State) NextWord() {
|
|||||||
for _, clue := range state.Puzzle.Clues {
|
for _, clue := range state.Puzzle.Clues {
|
||||||
if clue == state.SelectedClue {
|
if clue == state.SelectedClue {
|
||||||
return
|
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.SelectedClue = clue
|
||||||
state.SelectedCell = state.FirstUnfilledCellForClue(clue)
|
state.SelectedCell = state.FirstUnfilledCellForClue(clue)
|
||||||
return
|
return
|
||||||
|
|||||||
Reference in new issue
Block a user