That's an interesting approach. I still doubt it will complete in the life of the universe though.

This is my random generator/validator for approximating the percentage of valid patterns. It is 3.5 times faster than your original, but still if all the clouds in all the world, (a veritable storm), ran this and nothing else it would still take longer than the life of the universe to date.

#! perl -slw use strict; #use Math::Random::MT qw[ rand ]; $|++; our $I //= 1e6; my( $tried, $good ); for ( 1 .. $I ) { ++$tried; my @b = map int( rand 6 ), 1 .. 64; $good += checkBoard( \@b ); # displayBoard( \@b ); print "$good of $tried"; <STDIN>; printf "\r%10u %18.15f ", $tried, $good / $tried unless $tried % 1 +0000; } sub checkBoard { my $ref = shift; for( [0..7],[8..15],[16..23],[24..31],[32..39],[40..47],[48..55],[5 +6..63], [ 0, 8,16,24,32,40,48,56], [ 1, 9,17,25,33,41,49,57], [ 2,10,18,26,34,42,50,58], [ 3,11,19,27,35,43,51,59], [ 4,12,20,28,36,44,52,60], [ 5,13,21,29,37,45,53,61], [ 6,14,22,30,38,46,54,62], [ 7,15,23,31,39,47,55,63], ) { my $n = 0; join( '', @{$ref}[ @$_ ] ) =~ m[(.)\1\1] and return 0; } return 1 } sub displayBoard { print for unpack '(A16)*', join ' ', @{ $_[ 0 ] } }

I *think* I now know how to write a program to generate a calculation that will produce the count. Your original program will be useful for testing the calculation against (much) smaller test cases. If it gets close for them, and results in a percentage of the 6^64 possibilities of 8.972% (approximation from 100 million trials), then it will be reasonable to assume the calculation is um...reasonable :)


In reply to Re^4: Pattern enumeration. by BrowserUk
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.