#149266 - 2005-10-06 01:12 AM
Re: KiXgolf: Fragmentation - Public Coding
|
maciep
Korg Regular
Registered: 2002-06-14
Posts: 947
Loc: Pittsburgh
|
With a score of 225...
Code:
Function F($d) dim $u,$,$i,$j,$a[255],$b[255,15],$t[255] $u = ubound($d) for $j=0 to $u for $i=0 to $u $F=$d[$j]+$d[$i] $a[$u*$j+$j+$i]=$F $=ascan($a,$F) if 0=$b[$,$j] + $b[$,$i] + ($i=$j) $b[$,$j]=1 $b[$,$i]=1 $t[$]=$t[$]+2 if $t[$]=$u+1 exit ;endif ;endif ;next ;next EndFunction
|
Top
|
|
|
|
#149267 - 2005-10-06 01:43 AM
Re: KiXgolf: Fragmentation - Public Coding
|
Allen
KiX Supporter
Registered: 2003-04-19
Posts: 4549
Loc: USA
|
Code:
;255 function f($) dim $h,$c,$o,$t,$a $f=ubound($) do $h=$c+1 do $a=$[$c]+$[$h] if len($a)=2*len(join($,""))/($f+1) $o=$o + " "+$a+" "+$[$h]+$[$c] endif $h=$h+1 until $h>$f $c=$c+1 until $c=$f $o=trim($o) for each $ in split($o) $h=ubound(split($o,$)) if $h>$t $t=$h $f=$ endif next endfunction
|
Top
|
|
|
|
#149269 - 2005-10-06 01:50 AM
Re: KiXgolf: Fragmentation - Public Coding
|
Allen
KiX Supporter
Registered: 2003-04-19
Posts: 4549
Loc: USA
|
Quote:
;endif ;endif ;next ;next
okay... is kixtart still reading these as endif's and next's... and since this is a comment is the scoring engine ignoring them?
|
Top
|
|
|
|
#149270 - 2005-10-06 01:54 AM
Re: KiXgolf: Fragmentation - Public Coding
|
Shawn
Administrator
Registered: 1999-08-13
Posts: 8611
|
heheee ....
Code:
;endif ;endif ;next ;next
You are a dirty dawg Eric ... thats why I like yah.
|
Top
|
|
|
|
#149272 - 2005-10-06 01:56 AM
Re: KiXgolf: Fragmentation - Public Coding
|
maciep
Korg Regular
Registered: 2002-06-14
Posts: 947
Loc: Pittsburgh
|
My code? I've been working with a group of developers from NASA to try and figure out wtf your $e var is doing
Basically my code, just enumerates all possible combinations (for loops), keeps a count of how many times i've 'seen' that combination ($t array), ensures that a 'file piece' is only used once per combination ($b array) and also make sure i don't create a combination by adding a 'file piece' to itself - that would be impossible ($i=$j stuff)
if every piece can be used for the same combination (count=ubound+1) - we're done.
|
Top
|
|
|
|
#149273 - 2005-10-06 01:56 AM
Re: KiXgolf: Fragmentation - Public Coding
|
Lonkero
KiX Master Guru
Registered: 2001-06-05
Posts: 22346
Loc: OK
|
Code:
Function F($d) dim $u,$,$i,$j,$a[255],$b[255,15],$t[255] $u = ubound($d) for $j=0 to $u for $i=0 to $u $F=$d[$j]+$d[$i] $a[$u*$j+$j+$i]=$F $=ascan($a,$F) if 0=$b[$,$j] + $b[$,$i] + ($i=$j) $b[$,$j]=1 $b[$,$i]=1 $t[$]=$t[$]+2 if $t[$]>$u exit ;endif ;endif ;next ;next EndFunction
Code:
KiXtart Engine KiXtart Version = 4.50 (WKIX32.EXE) KiXGolf Script = kixgolf_fragmentation.kix
Computer OS = Windows 2000 Professional CPU = Intel Pentium III Speed = 797 MHz Memory = 376 MB
KiXGolf Scoring Engine Scoring Engine = 3.0.3
KiXGolf Score Tournament = Fragmentation Processing Start = 2005/10/06 02:34:45.393 Processing End = 2005/10/06 02:34:47.616 Duration = 0000/00/00 00:00:02.222 Used Processor Time = 00:00:01.812 # Tests Run = 180 # Tests Passed = 180 # Tests Failed = 0 Result = passed KiXGolf Score = 223
Thank you for participating in KiXtart Golf! Press any key to continue...
_________________________
!download KiXnet
|
Top
|
|
|
|
#149275 - 2005-10-06 01:59 AM
Re: KiXgolf: Fragmentation - Public Coding
|
maciep
Korg Regular
Registered: 2002-06-14
Posts: 947
Loc: Pittsburgh
|
Shawn, it's just the dawg in me
|
Top
|
|
|
|
#149278 - 2005-10-06 02:15 AM
Re: KiXgolf: Fragmentation - Public Coding
|
Allen
KiX Supporter
Registered: 2003-04-19
Posts: 4549
Loc: USA
|
Code:
;endif ;endif ;next ;next
I'm amazed that works. I tried removing the last endif but it barfed because of the next after it. It never crossed my mind to remove the next. Brilliant! That would have dropped my score to 246.
[edit]... Les where did you come from... I don't see your score anywhere
Edited by Allen (2005-10-06 02:17 AM)
|
Top
|
|
|
|
#149281 - 2005-10-06 02:27 AM
Re: KiXgolf: Fragmentation - Public Coding
|
maciep
Korg Regular
Registered: 2002-06-14
Posts: 947
Loc: Pittsburgh
|
With a few modifications, like stealing Lonks use of a (instead of " ") as a separator, which was very smooth, here's an updated version of Allens's code with a score 233
Code:
function f($) dim $h,$c,$o,$t,$a $f=ubound($) do $h=$c+1 do $a=$[$c]+$[$h] if len($a)=2*len(join($,""))/($f+1) $o=$o + a +$a+ a+ $[$h]+$[$c] endif $h=$h+1 until $h>$f $c=$c+1 until $c=$f for each $ in split($o,a) $h=ubound(split($o,$)) if $h>$t $t=$h $f=$ ;endif ;next endfunction
|
Top
|
|
|
|
Moderator: Arend_, Allen, Jochen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Mart
|
1 registered
(Allen)
and 496 anonymous users online.
|
|
|