#149306 - 2005-10-06 07:15 PM
Re: KiXgolf: Fragmentation - Public Coding
|
maciep
Korg Regular
Registered: 2002-06-14
Posts: 947
Loc: Pittsburgh
|
I believe it is the brand new solution i came up with
Quote:
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
--------------------------------------------------------------------------------
|
Top
|
|
|
|
#149313 - 2005-10-07 01:54 PM
Re: KiXgolf: Fragmentation - Public Coding
|
maciep
Korg Regular
Registered: 2002-06-14
Posts: 947
Loc: Pittsburgh
|
Damn jooel, you golfed the f out of this function. Here's one more stroke...i knew i got a math minor for a reason.
Code:
Function f($u) dim $,$i,$j,$c $j=ubound($u) while $c<$j dim $x[$j] $f='' $c=0 for $=1 to 2*(0^join($u,'')) $f=$f+rnd(1) $=$+$j next for $=0 to $j for $i=0 to $j if 1 ^ $x[$i] | $x[$] | $i=$ | $f<>$u[$]+$u[$i] $c=$c+2 $x[$i]=1 $x[$]=1 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/07 07:31:15.755 Processing End = 2005/10/07 07:31:43.052 Duration = 0000/00/00 00:00:27.296 # Tests Run = 180 # Tests Passed = 180 # Tests Failed = 0 Result = passed KiXGolf Score = 206
|
Top
|
|
|
|
#149314 - 2005-10-07 03:10 PM
Re: KiXgolf: Fragmentation - Public Coding
|
MightyR1
MM club member
Registered: 1999-09-09
Posts: 1264
Loc: The Netherlands
|
337:
Code:
Function F($)
Dim $m,$i,$j,$g,$k,$l,$u,$v,$a,$s,$p $m=ubound($) $l=2*len(join($,''))/($m+1)
for $i=0 to $m for $j=0 to $m
$p=$[$i]+$[$j]
if len($p) = $l $s=$s+','+$p $a=split(substr($s,2),',')
$u=0 for $k=0 to ubound($a) if ascan($a,$p,$k,1) >=0 $u=1+$u endif next
if $v <= $u $v=$u $g=1 for $k=0 to $m if not instr($p,$[$k]) $g=0 endif next if $g $f=$p endif endif
endif
next next
EndFunction
_________________________
Greetz, Patrick Rutten
- We'll either find a way or make one... - Knowledge is power; knowing how to find it is more powerful... - Problems don't exist; they are challenges...
|
Top
|
|
|
|
#149321 - 2005-10-08 12:49 AM
Re: KiXgolf: Fragmentation - Public Coding
|
Allen
KiX Supporter
Registered: 2003-04-19
Posts: 4549
Loc: USA
|
Howabout a explaination as to how the hell all that works... especially
Quote:
if 1 ^ $x[$i] | $x[$] | $i=$ | $f<>$u[$]+$u[$i]
|
Top
|
|
|
|
Moderator: Arend_, Allen, Jochen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Mart
|
0 registered
and 686 anonymous users online.
|
|
|