Do you know where your variables are? | |
PerlMonks |
Re^3: Scrabble word arrangements with blank tilesby Anonymous Monk |
on Nov 14, 2005 at 09:13 UTC ( [id://508245]=note: print w/replies, xml ) | Need Help?? |
To clarify the problem, assume we are trying to arrange 7 tiles
that already have been chosen. ABCDEFG generates 7! = 5,040 unique permutations ABCDEF? generates 115,920 unique permutations and not 6!*26=18,720 ABCDE?? <-- This is the stumper! The keyword is "unique" permutations. For example, permuting ABC? where ? represents a blank tile A..Z
results in 624 arrangements but only 588 are unique permutations.
Duplicate arrangements like AABC AABC AACB AACB ABAC ABAC ABBC ABBC
... must be culled to get the unique set. Algorithm-Loops
has a neat permute function which I used to check racks with one
blank tile.
do {
prints:
Any suggestions on how to code this for 2 blank tiles without getting "Out of memory" failure?
In Section
Seekers of Perl Wisdom
|
|