I started playing with a recursive solution that builds grids from smaller grids. Bonus: This method naturally omits permutations.

For example, given

2x2, 2 syms: AA AB AB BB AB BA
One can overlap the 2x2 grids to form:
3x3, 2 syms: 13 22 31 33 33 13 33 31 22 33 AAB ABA ABB ABA ABA BBA ABA BAA BAB BAB AAB BAB ABB BAB ABA

I think it might be possible to turn this into an efficient solution for counting the arrangements instead of generating them.

That's all I had time to do for now.

Update: At time of writing, I thought

F FF
wasn't allowed. The concept still applies, although there would be a lot more possible grids.

In reply to Re^3: Pattern enumeration. by ikegami
in thread Pattern enumeration. by BrowserUk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.