[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [FWP] Anacrossagrams



Fergal wrote:
> Try
> 
> anacrossagram(
> 	[qw( abcd afgh ijkl mnop )],
> 	[qw( afkp bajn cgko dhlp )],
> );
> 
> This has a solution, 

No, it doesn't.  

Add the following block of code after the first print in my sub
anacrossagrams:

{
  # see if the problem is even soluble:
  my @a = sort map { split // } @across;
  my @d = sort map { split // } @down;
  unless ( "@a" eq "@d" ) {
    print "Impossible to solve, because 
across letters: @a
  down letters: @d
";
    return();
  }
} 


John Porter


==== Want to unsubscribe from Fun With Perl?  Well, if you insist...
==== Send email to <fwp-request@technofile.org> with message _body_
====   unsubscribe