Open yonatanm opened 2 years ago
Thanks so much for your message!
I just tested it out. Yes, order does appear to matter!
Here are a few ideas I quickly came up with that might be a little bit helpful:
I think that having many different fitness functions that one could choose from would be really neat! Maybe this is something to be done in the future.
Thanks for your suggestion, here is my POV
Random ? I can do that on the app level Sort? Yes, but I won't get the best possible crossword (as determined by your fitness function) The third option is best. I can do it at the app level, and run all the permutations of order (n!). That way I can either use my owner fitness function or (preferred) have generateLayout() return its rank.
BTW, I'm using it in a side project. I run generateLayout() for all permutations I can imagine (explained below) and then I use my own fitness function to pick the best.
If I permute each SAPCE in an answer, I can decide where to delete it (and make it a long word without spaces) or to split it to a "sub" clue-answer pair. which gives me 2^[number-of-spaces] permutations (which is not ideal)
for example:
[{answer: "hello world", clue: "whatever"}] --->
p1:
[{answer: "helloworld", clue: "whatever", originalAnswer: "hello world"}]
p2:
[{answer: "hello", clue: "whatever", originalAnswer: "hello world"},
{answer: "world", clue: "whatever", originalAnswer: "hello world"}]
when I change the order of the objects {answer: 'xxx', clue: 'yyy} within the input array to the main generateLayout() function I get a different layout.
considering the fitness function - could be that a different order of the input will yield a better layout ?