My contribution...

Loops=100 and fast!

Take a look at my CPU info & Speed; a bug in KiX???

quote:

Average CD Length = 44.60
Average Gap = 0.40
Average Gap [%] = 0.88

KiXtart
KiXtart Version = 4.20
KiXGolf Script = kixgolf_cd.kix

Computer
OS = Windows XP Professional
CPU = Mobile Intel(R) Pentium(R) 4 - M CPU 2.20GHz
Speed = 1196 MHz
Memory = 511 MB

KiXGolf Scoring Engine
Scoring Engine = 3.0.3

KiXtart Golf Score
Tournament = KiXtart Golf: CD Sorter
Processing Start = 2003/03/15 22:36:23.772
Processing End = 2003/03/15 22:38:59.997
Duration = 0000/00/00 00:02:36.225
# Loops = 100
# Processed CDs = 12
# Valid CDs = 12
# Full CDs = 0
KiXGolf Result = Valid CD Filling
KiXGolf Score = 427

Thank you for participating in KiXtart Golf!

code:
Function CDSorter($a, $b)
Dim $n,$,$c,$d,$x,$j
;!
Break on
;!
$a=Split($a,',')
$n=Ubound($a)
$x=$a
For $=0 to $n
$x[$]=1+$
Next
For $=1 to $n
$c=0.+$a[$-1]
$d=$x[$-1]
If 0.+$a[$] > $c
$a[$-1]=0.+$a[$]
$x[$-1]=$x[$]
$a[$]=$c
$x[$]=$d
$=0
EndIf
Next
For $=0 to $n
$c=0.+$a[$]
$d=','+$x[$]
If $c > $b-1 AND $c < $b
$=$n
Else
For $j=$+1 to $n
$c=$c+$a[$j]
If $c < $b
$d=$d+','+$x[$j]
If $c > $b-1
$j=$n
EndIf
Else
$c=$c-$a[$j]
$j=$j+1
EndIf
Next
If $c > $b-1 AND $c < $b
$=$n
EndIf
EndIf
Next
$CDsorter=SubStr($d,2)
EndFunction



[ 15. March 2003, 22:34: Message edited by: MightyR1 ]
_________________________
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...