jonadsimon / wonder-words-generator

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

Reindex positions and orientations to enforce true desires #66

Closed jonadsimon closed 2 years ago

jonadsimon commented 2 years ago

Want the center of each word to be as close to the center of the board as possible.

Currently because the variables (position and orientation) are selected serially, they induce undesirably behaviors like sliding a words along the entire horizontal axis before ever attempting to slid it up or down.

To overcome this we need to define an explicit ordering on the board positions of the type desired.

In particular, we need to ensure that the positions indexed from lowest-to-highest spiral outwards from the center of the board, and that the orientations rotate around the unit circle.

Positions example: 5 4 3 6 1 2 7 8 9 ... Orientations example: →, ↗, ↑, ↖, ←, ↙, ↓, ↘

Ideally we would also incentivize overlaps to keep words from piling up in the center in parallel, but this can't be enforced in the existing framework. In fact, it's likely that even under the current optimization procedures this is what's causing a lot of the problems.

jonadsimon commented 2 years ago

Despite STRONG intuition that this should work, am finding that it... doesn't. Maybe because of unexpected interaction between position and delta?

Next steps: (1) use verbose debugging to verify that the script is doing what I think it is (2) revert delta behavior back to previous while leaving spiral-position behavior intact

jonadsimon commented 2 years ago

Double-check logic, then update to use piping constraint instead of nested-arrays. Minizinc might be able to do better optimization.

jonadsimon commented 2 years ago

Failure to generate even very basic boards (1.0x density) implies that heuristic is VERY wrong

jonadsimon commented 2 years ago

Fixed off-by-1 indexing bug that now allows it to build simple loose boards, however still doesn't work well at all by comparison. Try a bit more, then abandon this route of inquiry.

python make_puzzle_v2.py "qual" "coffee" "celebration" --packing-constant=1.0 --strategy=median --optimize-words

...

horizontal (fwd/bwd): 1/2
vertical (fwd/bwd): 8/11
diagonal du (fwd/bwd): 3/3
diagonal ud (fwd/bwd): 2/17

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

africa   agon   banana   bash   bean   beer   bread   brew   brown   cake   cancer   chai   cheer   cocoa   coke   cola   corn   decaf   drink   easter   event   feast   feria   fete   gala   java   juice   khat   latte   milk   mill   mocha   parade   party   persia   plant   qual   revel   seed   snack   soda   sugar   test   tree   umber   wine   yemen
jonadsimon commented 2 years ago

Checked in at https://github.com/jonadsimon/wonder-words-generator/commit/c11dc9fd829da76aec45fb8208561553c7f3da1d

Don't bother trying to push this avenue further, it's a dead end