Constructing Crossword Arrays Faster
Michael Trott · The Mathematica Journal · 2009
In [12]:= positionAWordcharacterList_, k_, i0_, j0_, hv : "" "", f_: Null : Module LengthcharacterList, i, j, cs, Which The current word is to be placed horizontally. hv "", Nothing can be placed immediately before or after the current word. statusi0 k, j0 C; statusi0 k 1, j0 C; Place the characters from the list characterList horizontally. Doi i0 k ; cs statusi, j0; statusi, j0 Which Part of a vertical word is already in place. MatchQcs, C_String, cs, Both directions are now used. MatchQcs, CcharacterList, "", CcharacterList, Headcs C && cs2 "", Allow the first and last character to be reused. If 1 , CcharacterList, "", CcharacterList, Nothing is already in place. Headcs status, CcharacterList, ""; Here is a potential side effect. fi, j0, characterList, , ; Set the status of squares in the rows below and above the row just set.