#99663 - 2003-03-17 05:32 PM
Re: KiXGolf: CD Sorter, Part II (public)
|
Howard Bullock
KiX Supporter
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
For some reason the compare failed.
This was captured after the "until" before the "IF".
Until: 45=44.5 0 code:
function CDSorter($w, $) Dim $x, $b do ? "Until: "+ $+"="+$b + " " + ($=$b) ? "" + $b + "<"+$ if $b<$ ? "in if" ? "w="+$w $x = split($w,",") endif $b=0.5 Dim $z,$q,$ for each $q in $x $=1+$ if $q $b = $b + $q $z=$z+","+$ endif next ;? "" + ubound($x) + " " + ($-2) $x[RND($-1)]=0 $CDSorter=substr($z,2)
until $=$b ? "$="+$ ? "$b="+$b endfunction
|
Top
|
|
|
|
#99665 - 2003-03-17 05:44 PM
Re: KiXGolf: CD Sorter, Part II (public)
|
Howard Bullock
KiX Supporter
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
Run this: code:
Break On $=45 $a=44.5 ? ($=$a)
$=44 $a=43.5 ? ($=$a)
$=43 $a=42.5 ? ($=$a)
$=42 $a=41.5 ? ($=$a)
the rounding rule appears to be round down on EVEN and up on ODD.
|
Top
|
|
|
|
#99667 - 2003-03-17 05:49 PM
Re: KiXGolf: CD Sorter, Part II (public)
|
Howard Bullock
KiX Supporter
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
Duh, just a little thick here.
|
Top
|
|
|
|
#99669 - 2003-03-17 07:33 PM
Re: KiXGolf: CD Sorter, Part II (public)
|
Howard Bullock
KiX Supporter
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
So Lonk, given the current issue with the rounding are you wanting to maintain your last posted code as a contender? It did pass the test suite. If you don't, I still have the lead at 182. If you do, then I'll pop a couple more Ibuprofens and have a go at it.
|
Top
|
|
|
|
#99672 - 2003-03-17 08:03 PM
Re: KiXGolf: CD Sorter, Part II (public)
|
Lonkero
KiX Master Guru
Registered: 2001-06-05
Posts: 22346
Loc: OK
|
and "perfect" 182 score comes from:
code:
function CDSorter($w, $) Dim $x, $b do if $b<$ $x = split($w,",") endif $b=0.49 Dim $z,$q,$ for each $q in $x $=1+$ if $q $b = $b + $q $z=$z+","+$ endif next $x[RND($-2)]=0 $CDSorter=substr($z,2) until $=$b endfunction
but, I think we need some ruling from outside on this.
_________________________
!download KiXnet
|
Top
|
|
|
|
#99673 - 2003-03-17 08:43 PM
Re: KiXGolf: CD Sorter, Part II (public)
|
Jack Lothian
MM club member
Registered: 1999-10-22
Posts: 1169
Loc: Ottawa,Ontario, Canada
|
|
Top
|
|
|
|
#99674 - 2003-03-17 10:18 PM
Re: KiXGolf: CD Sorter, Part II (public)
|
Howard Bullock
KiX Supporter
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
My perfect 183 should handle anything.
code:
function CDSorter($w, $) Dim $x, $b do $x = split($w,",") do $b=0. Dim $z,$q,$ for each $q in $x $=1+$ if $q $b = $b + $q $z=$z+","+$ endif next $x[RND($-1)]=0 $CDSorter=substr($z,2) until $b<=$ until $b > $-1 endfunction
code:
Average CD Length = 44.45 Average Gap = 0.55 Average Gap [%] = 1.21
KiXtart KiXtart Version = 4.21 Release Candidate 1 KiXGolf Script = kixgolf_cd.kix
Computer OS = Windows 2000 Professional CPU = Intel Pentium III Speed = 848 MHz Memory = 511 MB
KiXGolf Scoring Engine Scoring Engine = 3.0.3
KiXtart Golf Score Tournament = KiXtart Golf: CD Sorter Processing Start = 2003/03/17 16:19:11.216 Processing End = 2003/03/17 16:19:48.775 Duration = 0000/00/00 00:00:37.559 # Loops = 1 # Processed CDs = 13 # Valid CDs = 13 # Full CDs = 0 KiXGolf Result = Valid CD Filling KiXGolf Score = 183 Thank you for participating in KiXtart Golf
[ 17. March 2003, 22:19: Message edited by: Howard Bullock ]
|
Top
|
|
|
|
#99676 - 2003-03-18 06:05 AM
Re: KiXGolf: CD Sorter, Part II (public)
|
Lonkero
KiX Master Guru
Registered: 2001-06-05
Posts: 22346
Loc: OK
|
well, needed to go pretty far and this still is not perfect...
code:
function CDSorter($w, $) Dim $x, $b do if $b<$ $x = split($w+",",",") endif $b=0.4999 Dim $z,$q,$ for each $q in $x $=1+$ if $q $b = $b + $q $z=$z+","+$ endif next $x[RND($-1)]=0 $CDSorter=substr($z,2) until $=$b endfunction
it makes the assumption that ppl do not give msecs as input. only then it is fully trustable.
quote:
Average CD Length = 44.55 Average Gap = 0.45 Average Gap [%] = 1.00
KiXtart KiXtart Version = 4.21 Release Candidate 1 KiXGolf Script = kixgolf_cd.kix
Computer OS = Windows 2000 Professional CPU = Intel Pentium III Speed = 797 MHz Memory = 375 MB
KiXGolf Scoring Engine Scoring Engine = 3.0.3
KiXtart Golf Score Tournament = KiXtart Golf: CD Sorter Processing Start = 2003/03/18 07:09:33.271 Processing End = 2003/03/18 07:09:46.079 Duration = 0000/00/00 00:00:12.808 # Loops = 1 # Processed CDs = 15 # Valid CDs = 15 # Full CDs = 2 KiXGolf Result = Valid CD Filling KiXGolf Score = 188 Thank you for participating in KiXtart Golf!
_________________________
!download KiXnet
|
Top
|
|
|
|
#99677 - 2003-03-18 01:05 PM
Re: KiXGolf: CD Sorter, Part II (public)
|
Howard Bullock
KiX Supporter
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
Holes and inadequacies can be found in even the most accepted software. Take M$ Windows and their other suites of products for example. Just because there are security holes, bugs, and other things people gripe over does not mean that they are not usable and helpful.
I salute Jooel in his innovative approach and his score of 182 using the integer rounding methogology. I think that by adding the one stroke and using .49 for a score of 183 makes the program usable.
So it appears that we both have usable programs at a score of 183. My head hurts trying to improve upon either code example.
Again the Golf challenge has brought to light a couple of items of interest. 1) the use of scoped variables in KiXtart and 2) the rounding method automatically employed when evaluating integers and doubles.
Thanks Jens for another entertaining week. [ 18. March 2003, 13:08: Message edited by: Howard Bullock ]
|
Top
|
|
|
|
#99679 - 2003-03-18 02:14 PM
Re: KiXGolf: CD Sorter, Part II (public)
|
maciep
Korg Regular
Registered: 2002-06-14
Posts: 947
Loc: Pittsburgh
|
Not so fast. All I have to do is knock a mere 40 strokes off my score, and I'm right back in it
code:
function CDSorter($a, $b) dim $c, $, $u,$p, $t $c = split($a, ",") $u = ubound($c) srnd(@TICKS) do $ = rnd($u) $p = -0.5 + $b redim $a[$] do $t = rnd($u)+1 if ascan($a, $t)<0 $p = $p - $c[$t-1] $a[$] = $t $=$-1 endif until $ < 0 until 0=$p $CDSorter = join($a,",") endfunction
Notice that if you start at medialength-0.5 and subtract, then you don't have to worry about rounding, -0.5<= n <=0.5 always rounds to 0
_________________________
Eric
|
Top
|
|
|
|
#99681 - 2003-03-18 02:25 PM
Re: KiXGolf: CD Sorter, Part II (public)
|
Howard Bullock
KiX Supporter
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
Ya, but through detailed and painstaking statistical analysis (SWAG) I have determined that you need $b=0.499 to be on par with quality of my code. Which takes you to 183 buddy. [ 18. March 2003, 14:26: Message edited by: Howard Bullock ]
|
Top
|
|
|
|
#99682 - 2003-03-18 02:31 PM
Re: KiXGolf: CD Sorter, Part II (public)
|
maciep
Korg Regular
Registered: 2002-06-14
Posts: 947
Loc: Pittsburgh
|
Joel, As long as the gap is one it doesn't matter. quote:
CD #1 Title = 70's Super Funk Song #s = 12,4,2,5,16,11,10,19 CD Length = 43.1650 CD Gap = 0.8350 CD Gap [%] = 1.8977 Req. CD Length = 43.0000 Result = CD has been filled Processing Start = 2003/03/18 08:35:21.347 Processing End = 2003/03/18 08:35:21.362 Duration = 0000/00/00 00:00:00.014
CD #2 Title = Partridge Family Unlimited Song #s = 7,4,11,17,2 CD Length = 43.9557 CD Gap = 0.0443 CD Gap [%] = 0.1007 Req. CD Length = 43.0000 Result = CD has been filled Processing Start = 2003/03/18 08:35:21.362 Processing End = 2003/03/18 08:35:21.409 Duration = 0000/00/00 00:00:00.046
CD #3 Title = Three Tenors in Antarctica, Again! Song #s = 9,4,15,7,2,3,13,5,1,14 CD Length = 43.8456 CD Gap = 0.1544 CD Gap [%] = 0.3509 Req. CD Length = 43.0000 Result = CD has been filled Processing Start = 2003/03/18 08:35:21.409 Processing End = 2003/03/18 08:35:21.409 Duration = 0000/00/00 00:00:00.000
CD #4 Title = Support Your Local KiXGolfer Song #s = 9,30 CD Length = 43.2000 CD Gap = 0.8000 CD Gap [%] = 1.8182 Req. CD Length = 43.0000 Result = CD has been filled Processing Start = 2003/03/18 08:35:21.409 Processing End = 2003/03/18 08:35:23.784 Duration = 0000/00/00 00:00:02.375
CD #5 Title = ABBA Bubba! Song #s = 3,15,5,26,25,14,12,18,20,22,23,4,30,16,17,1 CD Length = 43.8258 CD Gap = 0.1742 CD Gap [%] = 0.3959 Req. CD Length = 43.0000 Result = CD has been filled Processing Start = 2003/03/18 08:35:23.784 Processing End = 2003/03/18 08:35:23.878 Duration = 0000/00/00 00:00:00.094
CD #6 Title = Songs You Never Wanted Your Teenage Daughter To Know About Song #s = 9,6,2 CD Length = 43.3000 CD Gap = 0.7000 CD Gap [%] = 1.5909 Req. CD Length = 43.0000 Result = CD has been filled Processing Start = 2003/03/18 08:35:23.878 Processing End = 2003/03/18 08:35:23.924 Duration = 0000/00/00 00:00:00.045
CD #7 Title = Moon Rocks! Song #s = 8,32,39,14,6,16,17,24,22,12,5,31,3,20,11 CD Length = 43.4082 CD Gap = 0.5918 CD Gap [%] = 1.3450 Req. CD Length = 43.0000 Result = CD has been filled Processing Start = 2003/03/18 08:35:23.924 Processing End = 2003/03/18 08:35:23.956 Duration = 0000/00/00 00:00:00.031
CD #8 Title = Ruud's Favs Song #s = 4,18,6,5,2,11,15,14,10,8,16,12,3,17,13 CD Length = 43.7376 CD Gap = 0.2624 CD Gap [%] = 0.5964 Req. CD Length = 43.0000 Result = CD has been filled Processing Start = 2003/03/18 08:35:23.956 Processing End = 2003/03/18 08:35:24.065 Duration = 0000/00/00 00:00:00.109
CD #9 Title = MTV Presents: KiXtart Rulez! Song #s = 25,34,41,44,4,43,16,11,50,5,23,2,31,30,1,37,21,35,6,48,27 CD Length = 43.0838 CD Gap = 0.9162 CD Gap [%] = 2.0823 Req. CD Length = 43.0000 Result = CD has been filled Processing Start = 2003/03/18 08:35:24.065 Processing End = 2003/03/18 08:35:24.206 Duration = 0000/00/00 00:00:00.140
CD #10 Title = Songs From the Programmer's Abyss Song #s = 24,8,37,21,34,12,18,20,2,10,43,35,44,42,14,39,41,3,28 CD Length = 43.8810 CD Gap = 0.1190 CD Gap [%] = 0.2705 Req. CD Length = 43.0000 Result = CD has been filled Processing Start = 2003/03/18 08:35:24.206 Processing End = 2003/03/18 08:35:25.034 Duration = 0000/00/00 00:00:00.828
CD #11 Title = Just Noise (100% Pure White Noise) Song #s = 70,47,62,59 CD Length = 43.2000 CD Gap = 0.8000 CD Gap [%] = 1.8182 Req. CD Length = 43.0000 Result = CD has been filled Processing Start = 2003/03/18 08:35:25.034 Processing End = 2003/03/18 08:35:25.409 Duration = 0000/00/00 00:00:00.375
CD #12 Title = Cazy Jens And the KIXGolfers Song #s = 68,60,62,64,61,47,94,65,95,15 CD Length = 43.0507 CD Gap = 0.9493 CD Gap [%] = 2.1575 Req. CD Length = 43.0000 Result = CD has been filled Processing Start = 2003/03/18 08:35:25.409 Processing End = 2003/03/18 08:35:28.580 Duration = 0000/00/00 00:00:03.171
Average CD Length = 43.47 Average Gap = 0.53 Average Gap [%] = 1.20
KiXtart KiXtart Version = 4.20 Release Candidate 3 KiXGolf Script = kixgolf_cd.kix
Computer OS = Windows XP Professional CPU = Intel Pentium III Speed = 730 MHz Memory = 126 MB
KiXGolf Scoring Engine Scoring Engine = 3.0.3
KiXtart Golf Score Tournament = KiXtart Golf: CD Sorter Processing Start = 2003/03/18 08:35:21.347 Processing End = 2003/03/18 08:35:28.580 Duration = 0000/00/00 00:00:07.233 # Loops = 1 # Processed CDs = 12 # Valid CDs = 12 # Full CDs = 0 KiXGolf Result = Valid CD Filling KiXGolf Score = 223
Thank you for participating in KiXtart Golf!
_________________________
Eric
|
Top
|
|
|
|
Moderator: Arend_, Allen, Jochen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Mart
|
0 registered
and 918 anonymous users online.
|
|
|