Here's another apporach using rnd() that just came to me. Golf away....
Code:
Function f($)
dim $u,$i,$j
$u=ubound($)
while 1
dim $x[$u],$c
$f=''
for $j=1 to 2*len(join($,""))/($u+1)
$f=$f+rnd(1)
next
for $j=0 to $u
for $i=0 to $u
if 0=($i=$j)+ $x[$i] + $x[$j]+ ($[$j]+$[$i]<>$f)
$c=$c+2
$x[$i]=1
$x[$j]=1
if $c>$u
exit
;endif
;endif
;next
;next
;loop
endfunction
Quote:
KiXtart Engine
KiXtart Version = 4.50
KiXGolf Script = kixgolf_fragmentation.kix
Computer
OS = Windows XP Professional
CPU = Intel(R) Xeon(TM) CPU 2.80GHz
Speed = 2790 MHz
Memory = 1024 MB
KiXGolf Scoring Engine
Scoring Engine = 3.0.3
KiXGolf Score
Tournament = Fragmentation
Processing Start = 2005/10/05 23:46:34.779
Processing End = 2005/10/05 23:47:04.670
Duration = 0000/00/00 00:00:29.891
# Tests Run = 180
# Tests Passed = 180
# Tests Failed = 0
Result = passed
KiXGolf Score = 217