jonadsimon / wonder-words-generator

Generates WonderWords puzzles
Apache License 2.0
2 stars 0 forks source link

Not catching doubled-up words #51

Closed jonadsimon closed 2 years ago

jonadsimon commented 2 years ago

For the following board, the word "CHAI" appears twice (both in the upper-right corner)

B E E R A V A J B R E W D I M
A N E M E Y B R E A D C A E Y
A E T E G E A A Y E R H W K A
I L R T F I H O A A C A N A D
S T U T R F C C D N D I G C O
R T G A O N O O N T R N N U T
E O O L W B M C U D Q H O E S
P B Y E K R U T S U F I S M V
L A A E C O R N A R D N O E D
A N T J S W S R I E A R D A U
N A R U O N K D C C R E I M K
T N I I D R A A K O K L B K A
A A L C A Y F E W L Y E L L T
H A L E E N I W B A R L E I D
K C O K E E W S E E D N D M M

Terminal command: python make_puzzle_v2.py morning coffee --packing-constant=1.14 --strategy=median --optimize-words

jonadsimon commented 2 years ago

Explanation: Issue is happening because when the hidden word is placed on the board, it coincidentally fills in the "I" to complete the word "CHAI", see 1st blank in the upper-left corner of the partially-completed board.

B E E R A V A J B R E W D _ _
_ N E M E Y B R E A D C A E Y
A E T E _ _ A A Y E R H W K A
I L R T F _ H O A A C A N A D
S T U T R F C C D _ D I G C O
R T G A O N O O N _ R N N U T
E O O L W B M C U D Q _ O E S
P B Y E K R U T S U F I S M V
L A A _ C O R N A R D N O E D
A N T J S W _ R I E A R D A U
N A R U O N K D C C R E I M K
T N I I D R A A K O K L B K A
A A L C A Y F E W L Y E L L T
H _ L E E N I W B A R L E I D
K C O K E E W S E E D _ _ M M
jonadsimon commented 2 years ago

Unclear what the best solution is to this. Should probably fail to output the board altogether in this case, and just rerun again separately with a different random seed.

Continuing with the retry logic would be functionally better, but harder to implement, so take the easy route

jonadsimon commented 2 years ago

Fixed in https://github.com/jonadsimon/wonder-words-generator/commit/96d92e05bd80ee3721c917c4d39de74fc4042c24