Page 4 of 5 <12345>
Topic Options
#99683 - 2003-03-18 02:34 PM Re: KiXGolf: CD Sorter, Part II (public)
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
maciep, you're getting closer. [Smile] A couple more 'Rocks' should do the trick and provide you the free thinking state you need to beat Jooel.
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#99684 - 2003-03-18 04:55 PM Re: KiXGolf: CD Sorter, Part II (public)
maciep Offline
Korg Regular
*****

Registered: 2002-06-14
Posts: 947
Loc: Pittsburgh
There's a new kid on the block

quote:

Average CD Length = 44.28
Average Gap = 0.72
Average Gap [%] = 1.60

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 11:01:00.095
Processing End = 2003/03/18 11:01:00.486
Duration = 0000/00/00 00:00:00.390
# Loops = 1
# Processed CDs = 12
# Valid CDs = 12
# Full CDs = 0
KiXGolf Result = Valid CD Filling
KiXGolf Score = 183

Thank you for participating in KiXtart Golf!

code:
function CDSorter($a, $b)
dim $, $u,$p, $t
srnd(@TICKS)
do
$p = -0.5 + $b
$u=""
$=0
for each $t in split($a, ",")
$=1+$
if rnd(2) and $p > $t
$p = $p - $t
$u = $u+ "," + $
endif
next
until 0=$p
$CDSorter = substr($u,2)
endfunction

_________________________
Eric

Top
#99685 - 2003-03-18 05:00 PM Re: KiXGolf: CD Sorter, Part II (public)
maciep Offline
Korg Regular
*****

Registered: 2002-06-14
Posts: 947
Loc: Pittsburgh
It looks like I don't need to seed the randomizer either.

quote:

Average CD Length = 44.30
Average Gap = 0.70
Average Gap [%] = 1.55

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 11:05:54.406
Processing End = 2003/03/18 11:05:54.843
Duration = 0000/00/00 00:00:00.436
# Loops = 1
# Processed CDs = 12
# Valid CDs = 12
# Full CDs = 0
KiXGolf Result = Valid CD Filling
KiXGolf Score = 171

Thank you for participating in KiXtart Golf!

code:
function CDSorter($a, $b)
dim $, $u,$p, $t
do
$p = -0.5 + $b
$u=""
$=0
for each $t in split($a, ",")
$=1+$
if rnd(2) and $p > $t
$p = $p - $t
$u = $u+ "," + $
endif
next
until 0=$p
$CDSorter = substr($u,2)
endfunction

_________________________
Eric

Top
#99686 - 2003-03-18 05:06 PM Re: KiXGolf: CD Sorter, Part II (public)
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
Would this shave two strokes:

if rnd(2) and $p > $t

becomes:

if rnd(2) & $p > $t

-Shawn

Top
#99687 - 2003-03-18 05:11 PM Re: KiXGolf: CD Sorter, Part II (public)
maciep Offline
Korg Regular
*****

Registered: 2002-06-14
Posts: 947
Loc: Pittsburgh
good call Shawn. It slows it down a bit, but this is a golf tournament.

quote:

Average CD Length = 44.26
Average Gap = 0.74
Average Gap [%] = 1.65

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 11:15:27.621
Processing End = 2003/03/18 11:15:33.605
Duration = 0000/00/00 00:00:05.984
# Loops = 1
# Processed CDs = 12
# Valid CDs = 12
# Full CDs = 0
KiXGolf Result = Valid CD Filling
KiXGolf Score = 169

Thank you for participating in KiXtart Golf!

code:
  
function CDSorter($a, $b)
dim $, $u,$p, $t
do
$p = -0.5 + $b
$u=""
$=0
for each $t in split($a, ",")
$=1+$
if rnd(2) & $p > $t
$p = $p - $t
$u = $u+ "," + $
endif
next
until 0=$p
$CDSorter = substr($u,2)
endfunction

_________________________
Eric

Top
#99688 - 2003-03-18 05:13 PM Re: KiXGolf: CD Sorter, Part II (public)
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
just when I lost my wksta!
_________________________
!

download KiXnet

Top
#99689 - 2003-03-18 05:13 PM Re: KiXGolf: CD Sorter, Part II (public)
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
Great stuff - good thinking.

code:
Average CD Length = 44.21
Average Gap = 0.79
Average Gap [%] = 1.77

KiXtart
KiXtart Version = 4.21 Release Candidate 1
KiXGolf Script = kixgolf_cd.kix

Computer
OS = Windows 2000 Professional
CPU = Intel Pentium III
Speed = 698 MHz
Memory = 511 MB

KiXGolf Scoring Engine
Scoring Engine = 3.0.3

KiXtart Golf Score
Tournament = KiXtart Golf: CD Sorter
Processing Start = 2003/03/18 11:16:47.098
Processing End = 2003/03/18 11:17:49.758
Duration = 0000/00/00 00:01:02.660
# Loops = 1
# Processed CDs = 13
# Valid CDs = 13
# Full CDs = 0
KiXGolf Result = Valid CD Filling
KiXGolf Score = 163

Thank you for participating in KiXtart Golf!

code:
function CDSorter($a, $b)
dim $p
do
dim $u, $, $t
$p = -0.5 + $b
for each $t in split($a, ",")
$u=1+$u
if rnd(2) & $p > $t
$p = $p - $t
$ = $ + "," + $u
endif
next
$CDSorter = substr($,2)
until 0=$p
endfunction

_________________________
Home page: http://www.kixhelp.com/hb/

Top
#99690 - 2003-03-18 05:17 PM Re: KiXGolf: CD Sorter, Part II (public)
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
161

code:
function CDSorter($a, $b)
dim $
do
dim $u, $q, $t
$ = -0.5 + $b
for each $t in split($a, ",")
$u=1+$u
if rnd(2) & $ > $t
$ = $ - $t
$q = $q + "," + $u
endif
next
$CDSorter = substr($q,2)
until 0=$
endfunction

code:
Average CD Length = 44.25
Average Gap = 0.75
Average Gap [%] = 1.68

KiXtart
KiXtart Version = 4.21 Release Candidate 1
KiXGolf Script = kixgolf_cd.kix

Computer
OS = Windows 2000 Professional
CPU = Intel Pentium III
Speed = 698 MHz
Memory = 511 MB

KiXGolf Scoring Engine
Scoring Engine = 3.0.3

KiXtart Golf Score
Tournament = KiXtart Golf: CD Sorter
Processing Start = 2003/03/18 11:21:57.525
Processing End = 2003/03/18 11:22:04.595
Duration = 0000/00/00 00:00:07.069
# Loops = 1
# Processed CDs = 13
# Valid CDs = 13
# Full CDs = 0
KiXGolf Result = Valid CD Filling
KiXGolf Score = 161

Thank you for participating in KiXtart Golf!

_________________________
Home page: http://www.kixhelp.com/hb/

Top
#99691 - 2003-03-18 05:21 PM Re: KiXGolf: CD Sorter, Part II (public)
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
maciep, great logic! Haven't fully digested it yet. Too busy reducing your code. [Wink]

You are welcome to ALL KixGolf sessions. If you had come up with this before Saturday, I would have thown in the the Towel.

Check out the little tricks used to shave strokes. They will be handy on your next outing.

Outstanding effort!. How did you come to think of this methodolgy?

[ 18. March 2003, 17:22: Message edited by: Howard Bullock ]
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#99692 - 2003-03-18 05:27 PM Re: KiXGolf: CD Sorter, Part II (public)
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
Oops! The "-0.5" bit you just like Jooel. Songs of 1.0000 length cause the script to enter an infinite loop.

Don't think that should count on any of the code samples though since the code does pass the Jens test suite. That was the goal after all. But if Jens thinks it should add a couple stroke? [Smile]

[ 18. March 2003, 17:27: Message edited by: Howard Bullock ]
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#99693 - 2003-03-18 05:36 PM Re: KiXGolf: CD Sorter, Part II (public)
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
hoby sorry.
your code hangs all the time with cd8!

can't get it to work.
_________________________
!

download KiXnet

Top
#99694 - 2003-03-18 05:40 PM Re: KiXGolf: CD Sorter, Part II (public)
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
You must have a sloowww computer. [Wink]

Just ran again. This code is a little slower than the others.
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#99695 - 2003-03-18 05:41 PM Re: KiXGolf: CD Sorter, Part II (public)
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
k, seems like it didn't actually hang but the code perfectly fits to my CPU frequence.
took about 5 mins to process the CD8
_________________________
!

download KiXnet

Top
#99696 - 2003-03-18 05:51 PM Re: KiXGolf: CD Sorter, Part II (public)
maciep Offline
Korg Regular
*****

Registered: 2002-06-14
Posts: 947
Loc: Pittsburgh
Lonkero,

Try it with "and" instead of "&". It should run a lot faster then.
_________________________
Eric

Top
#99697 - 2003-03-18 05:56 PM Re: KiXGolf: CD Sorter, Part II (public)
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
so, you mean that this is accepted as it passes?
code:
function CDSorter($a, $b)
dim $
do
dim $u, $q, $t
$ = 0.5 + $b
for each $t in split($a, ",")
$u=1+$u
if rnd(2) & $ > $t
$ = $ - $t
$q = $q + "," + $u
endif
next
$CDSorter = substr($q,2)
until 1=$
endfunction

quote:
Average CD Length = 44.32
Average Gap = 0.68
Average Gap [%] = 1.51

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 19:01:33.109
Processing End = 2003/03/18 19:01:41.972
Duration = 0000/00/00 00:00:08.862
# Loops = 1
# Processed CDs = 12
# Valid CDs = 12
# Full CDs = 0
KiXGolf Result = Valid CD Filling
KiXGolf Score = 160

Thank you for participating in KiXtart Golf!

_________________________
!

download KiXnet

Top
#99698 - 2003-03-18 06:28 PM Re: KiXGolf: CD Sorter, Part II (public)
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
154 ???

code:
function CDSorter($a, $)
do
dim $u, $q, $t
$ = 0.5 + $
for each $t in split($a, ",")
$u=1+$u
if rnd(2) & $ > $t
$ = $ - $t
$q = $q + "," + $u
endif
next
$CDSorter = substr($q,2)
until 1=$
endfunction


Top
#99699 - 2003-03-18 07:07 PM Re: KiXGolf: CD Sorter, Part II (public)
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
Shawn, that does not work, sorry. You have lost the original value of "$" and as a result causes problems.

KiXtart
KiXtart Version = 4.21 Release Candidate 1
KiXGolf Script = kixgolf_cd.kix

Computer
OS = Windows 2000 Professional
CPU = Intel Pentium III
Speed = 698 MHz
Memory = 511 MB

KiXGolf Scoring Engine
Scoring Engine = 3.0.3

KiXtart Golf Score
Tournament = KiXtart Golf: CD Sorter
Processing Start = 2003/03/18 13:10:25.863
Processing End = 2003/03/18 13:10:37.079
Duration = 0000/00/00 00:00:11.216
# Loops = 1
# Processed CDs = 13
# Valid CDs = 1
# Full CDs = 0
KiXGolf Result = Invalid CD Filling
KiXGolf Score = 154

Thank you for participating in KiXtart Golf!
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#99700 - 2003-03-18 07:10 PM Re: KiXGolf: CD Sorter, Part II (public)
maciep Offline
Korg Regular
*****

Registered: 2002-06-14
Posts: 947
Loc: Pittsburgh
Howard,

I just ran CD13 against the function using "and" instead of "&" and it passed.

quote:

CD #13
Title = Lonkero's Test
Song #s = 1,2,3,5,6,7,8,9,10,12,13,15,16,17,18,19,20,21,22,23,24,26,27,28,29,30,31,32,33,34
,35,36,37,38,39,40,41,42,43,44,45,46,47,49
CD Length = 44.0000
CD Gap = 1.0000
CD Gap [%] = 2.2222
Req. CD Length = 44.0000
Result = CD has been filled
Processing Start = 2003/03/18 13:14:21.820
Processing End = 2003/03/18 13:14:23.179
Duration = 0000/00/00 00:00:01.358

Average CD Length = 44.30
Average Gap = 0.70
Average Gap [%] = 1.56

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 13:14:21.679
Processing End = 2003/03/18 13:14:23.179
Duration = 0000/00/00 00:00:01.500
# Loops = 1
# Processed CDs = 13
# Valid CDs = 13
# Full CDs = 0
KiXGolf Result = Valid CD Filling
KiXGolf Score = 163

Thank you for participating in KiXtart Golf!

_________________________
Eric

Top
#99701 - 2003-03-18 07:19 PM Re: KiXGolf: CD Sorter, Part II (public)
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
Sorry about that yeah - i just realized my mistake as well - i copied the working function to another spot in my script but forgot to chage the function name. Learned on thing in that one can have multiple UDF with the same name but Kixtart takes the last one as good.
Top
#99702 - 2003-03-24 02:44 PM Re: KiXGolf: CD Sorter, Part II (public)
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
Jens, have you have time to start the recap?
_________________________
Home page: http://www.kixhelp.com/hb/

Top
Page 4 of 5 <12345>


Moderator:  Arend_, Allen, Jochen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 369 anonymous users online.
Newest Members
rrosell, PatrickPinto, Raoul, Timothy, Jojo67
17877 Registered Users

Generated in 0.078 seconds in which 0.029 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org