LonkeroAdministrator
(KiX Master Guru)
2005-10-06 01:09 AM
KiXgolf: Fragmentation - Public Coding

"Gentlemen, please post your code!" -Jens

LonkeroAdministrator
(KiX Master Guru)
2005-10-06 01:12 AM
Re: KiXgolf: Fragmentation - Public Coding

and here is my 229:
Code:

Function F($o)
Dim $,$r,$e,$c,$l
$c=1+Ubound($o)
$l = 2*Len(Join($o,$))/$c
Do
do
$f = Rnd($c-1)
until 0 = InStr($r,a+$f+a) - Len($+$o[$f]) mod $l * $e
$r = a+$f+a+$r
$e = ~ $e
$ = $ + $o[$f]
Until Len($) = $l * $c / 2
$f = Left($, $l)
If Join(Split($,$f),"") $f=f($o)
EndFunction



maciep
(Korg Regular)
2005-10-06 01:12 AM
Re: KiXgolf: Fragmentation - Public Coding

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



AllenAdministrator
(KiX Supporter)
2005-10-06 01:43 AM
Re: KiXgolf: Fragmentation - Public Coding

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



LonkeroAdministrator
(KiX Master Guru)
2005-10-06 01:45 AM
Re: KiXgolf: Fragmentation - Public Coding

maciep dude...
you always have a way to suprise.
your code is once again so wicked that I must stare it more than 5 minutes to understand what you do.

nice!


AllenAdministrator
(KiX Supporter)
2005-10-06 01:50 AM
Re: KiXgolf: Fragmentation - Public Coding

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?


ShawnAdministrator
(KiX Supporter)
2005-10-06 01:54 AM
Re: KiXgolf: Fragmentation - Public Coding

heheee ....

Code:

;endif
;endif
;next
;next



You are a dirty dawg Eric ... thats why I like yah.


Les
(KiX Master)
2005-10-06 01:54 AM
Re: KiXgolf: Fragmentation - Public Coding

KiX doesn't read them, it infers them and yes comments are ignored in scoring.

maciep
(Korg Regular)
2005-10-06 01:56 AM
Re: KiXgolf: Fragmentation - Public Coding

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.


LonkeroAdministrator
(KiX Master Guru)
2005-10-06 01:56 AM
Re: KiXgolf: Fragmentation - Public Coding

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...



LonkeroAdministrator
(KiX Master Guru)
2005-10-06 01:58 AM
Re: KiXgolf: Fragmentation - Public Coding

and, yes we are

maciep
(Korg Regular)
2005-10-06 01:59 AM
Re: KiXgolf: Fragmentation - Public Coding

Shawn, it's just the dawg in me

maciep
(Korg Regular)
2005-10-06 02:01 AM
Re: KiXgolf: Fragmentation - Public Coding

nice. i knew you'd be able to chop away at that.

LonkeroAdministrator
(KiX Master Guru)
2005-10-06 02:05 AM
Re: KiXgolf: Fragmentation - Public Coding

the $e-var?

well, it just goes from true to false, kinda.
and if it's false, happens [something] mod 0 that is always 0.

so in english, the line:
Code:

until 0 = InStr($r,a+$f+a) - Len($+$o[$f]) mod $l * $e


keeps the loop going on until a random number is met that is not already used and if doing a even loop, checks if file-length is matched.
that is, can't accept "01" and "101" as the first 2 pieces if $length is 10.
as that would break my left() (and it did in the beginning)
instead, the code keeps looking until it finds a pair that has the required length.


AllenAdministrator
(KiX Supporter)
2005-10-06 02:15 AM
Re: KiXgolf: Fragmentation - Public Coding

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


maciep
(Korg Regular)
2005-10-06 02:17 AM
Re: KiXgolf: Fragmentation - Public Coding

And now you know. In the last tourney, shawn and i both employed that forgiving nature of kix.

Les
(KiX Master)
2005-10-06 02:21 AM
Re: KiXgolf: Fragmentation - Public Coding

I don't golf. I just lurk about.

maciep
(Korg Regular)
2005-10-06 02:27 AM
Re: KiXgolf: Fragmentation - Public Coding

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



AllenAdministrator
(KiX Supporter)
2005-10-06 02:36 AM
Re: KiXgolf: Fragmentation - Public Coding

I kept thinking I needed to keep track of occurances of a good result, and if their were duplicates in the array, like Eric did. But then I realized even if there was a duplicate, it would create a good and bad result, and there should always be more good results than bad, so long as the length is right. Like I said a few days ago... it works... but not exactly the right way.

LonkeroAdministrator
(KiX Master Guru)
2005-10-06 02:46 AM
Re: KiXgolf: Fragmentation - Public Coding

I'm glad I took the rnd() route.
it seems that I would have had to use my brains with the brute force method.


maciep
(Korg Regular)
2005-10-06 02:47 AM
Re: KiXgolf: Fragmentation - Public Coding

Funny, you decided not to keep track but make sure the length was right. I decide that i didn't care what the length was but would just keep track.

I heart kix golf.


maciep
(Korg Regular)
2005-10-06 03:01 AM
Re: KiXgolf: Fragmentation - Public Coding

More with Allen's code

Code:

function f($)
dim $h,$c,$o,$t,$a
$f=ubound($)
for $c=0 to $f
for $h=$c+1 to $f
$a=$[$c]+$[$h]
if len($a)=2*len(join($,""))/($f+1)
$o=$o + a +$a+ a+ $[$h]+$[$c]
endif
next
next
for each $ in split($o,a)
$h=ubound(split($o,$))
if $h>$t
$t=$h
$f=$
;endif
;next
endfunction



Quote:


KiXtart Engine
KiXtart Version = 4.50
KiXGolf Script = kixgolf_fragmentation.kix

Computer
OS = Windows XP Professional
CPU = Intel(R) Xeon(TM)
Speed = 2790 MHz
Memory = 1024 MB

KiXGolf Scoring Engine
Scoring Engine = 3.0.3

KiXGolf Score
Tournament = Fragmentation
Processing Start = 2005/10/05 20:40:41.411
Processing End = 2005/10/05 20:40:41.661
Duration = 0000/00/00 00:00:00.250
# Tests Run = 180
# Tests Passed = 180
# Tests Failed = 0
Result = passed
KiXGolf Score = 221





AllenAdministrator
(KiX Supporter)
2005-10-06 03:07 AM
Re: KiXgolf: Fragmentation - Public Coding

Yeah Baby!

LonkeroAdministrator
(KiX Master Guru)
2005-10-06 03:36 AM
Re: KiXgolf: Fragmentation - Public Coding

fine.
220:
Code:

function f($)
dim $h,$c,$o,$t
$f=ubound($)
for $c=0 to $f
for $h=$c+1 to $f
$t = a+$[$c]+$[$h]+a
if len($t)=2+2*len(join($,""))/($f+1)
$o=$o+$t+$[$h]+$[$c]
endif
next
next
for each $ in split($o,a)
$h=ubound(split($o,$))
if $h>$t
$t=$h
$f=$
;endif
;next
endfunction



LonkeroAdministrator
(KiX Master Guru)
2005-10-06 03:53 AM
Re: KiXgolf: Fragmentation - Public Coding

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 04:31:15.674
Processing End = 2005/10/06 04:31:17.717
Duration = 0000/00/00 00:00:02.042
Used Processor Time = 00:00:00.981
# Tests Run = 180
# Tests Passed = 180
# Tests Failed = 0
Result = passed
KiXGolf Score = 218

Thank you for participating in KiXtart Golf!
Press any key to continue...


Code:

function f($)
dim $h,$c,$o,$t
$f=ubound($)
for $c=0 to $f
for $h=$c+1 to $f
$t = a+$[$c]+$[$h]+aa
if len($t)=2+2*len(join($))/($f+1)
$o=$o+$t+$[$h]+$[$c]
endif
next
next
for each $ in split($o,a)
$h=ubound(split($o,$))
if $h>$t
$t=$h
$f=$
endfunction



LonkeroAdministrator
(KiX Master Guru)
2005-10-06 03:55 AM
Re: KiXgolf: Fragmentation - Public Coding

217
Code:

function f($)
dim $h,$c,$o,$t
$f=ubound($)
for $c=0 to $f
for $h=$c+1 to $f
$t = a+$[$c]+$[$h]+a
if len($t)=1+2*len(join($))/($f+1)
$o=$o+$t+$[$h]+$[$c]
endif
next
next
for each $ in split($o,a)
$h=ubound(split($o,$))
if $h>$t
$t=$h
$f=$
endfunction



LonkeroAdministrator
(KiX Master Guru)
2005-10-06 03:57 AM
Re: KiXgolf: Fragmentation - Public Coding


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 04:35:57.640
Processing End = 2005/10/06 04:36:01.415
Duration = 0000/00/00 00:00:03.775
Used Processor Time = 00:00:01.111
# Tests Run = 180
# Tests Passed = 180
# Tests Failed = 0
Result = passed
KiXGolf Score = 215

Thank you for participating in KiXtart Golf!

Code:
 function f($)
dim $h,$c,$o,$t
$f=ubound($)
for $c=0 to $f
for $h=$c+1 to $f
$t = a+$[$c]+$[$h]
if len($t)=2*len(join($))/($f+1)
$o=$o+$t+a+$[$h]+$[$c]
endif
next
next
for each $ in split($o,a)
$h=ubound(split($o,$))
if $h>$t
$t=$h
$f=$
endfunction



AllenAdministrator
(KiX Supporter)
2005-10-06 04:05 AM
Re: KiXgolf: Fragmentation - Public Coding

Geezus... That's amazing!

maciep
(Korg Regular)
2005-10-06 06:08 AM
Re: KiXgolf: Fragmentation - Public Coding

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





Sealeopard
(KiX Master)
2005-10-06 06:22 AM
Re: KiXgolf: Fragmentation - Public Coding

Seems you guys are having fun.

I apologize for not having opened the public round. I sent an email to Jooel asking him to open the public round (Shawn should have a copy), which bounced because I had his old email address. My fault. To make a long story short, I was stuck at work in a meeting that went way into the evening, thus sneaked out to send an email via Blackberry :-(

I should be able to provide the private coding winners tomorrow and then we'll see how the public round goes. Interesting that the tricks from the last round are now being adapted and pushed to even more extremes. wonder what Ruud would say about this


maciep
(Korg Regular)
2005-10-06 02:02 PM
Re: KiXgolf: Fragmentation - Public Coding

By the way, it looks like Allen's code is flawed like my original was. It passes all of the tests, but, for example, if you change test 54 to '0,00,10,1', it breaks. It returns 000 instead of 100. It depends on the order of when combinations are added to $o

LonkeroAdministrator
(KiX Master Guru)
2005-10-06 02:50 PM
Re: KiXgolf: Fragmentation - Public Coding

you saying that all of the codes by allen are flawed?
hmm...
that makes me a leader again with your code

Jens, nice to hear you didn't forget us.
and no worries, we did manage on our own too.


maciep
(Korg Regular)
2005-10-06 02:58 PM
Re: KiXgolf: Fragmentation - Public Coding

actually, i think i'm the leader with the new code i posted...or maybe i missed something.

And here is the code that 'found' Allen's flaw. Logically, it should work the same as his original, but it fails.

Code:

function f($)
dim $h,$c,$o,$t
$f=ubound($)
for $c=0 to $f
for $h=0 to $f
$t = a+$[$c]+$[$h]
if len($t)=2*len(join($))/($f+1) and $h<>$c
$o=$o+$t
endif
next
next
for each $ in split($o,a)
$h=ubound(split($o,$))
if $h>$t
$t=$h
$f=$
endfunction



LonkeroAdministrator
(KiX Master Guru)
2005-10-06 03:39 PM
Re: KiXgolf: Fragmentation - Public Coding

you saying this fails or the original?
what is the test of yours?
I will add it to my tests and get it over with...


AllenAdministrator
(KiX Supporter)
2005-10-06 03:45 PM
Re: KiXgolf: Fragmentation - Public Coding

Possible solutions:
000 000 010 100 001 100 101 110

Which you are correct 000 would show up first. But in this case how would you know which is right since they both are just as likely to be the correct answer, and there are no duplicates?


LonkeroAdministrator
(KiX Master Guru)
2005-10-06 03:48 PM
Re: KiXgolf: Fragmentation - Public Coding

the introduction said, there is no possible duplicates.
that is, each test has only 1 match.

if this line works with 2, then it's not cool.
if only one, it can be calculated.


AllenAdministrator
(KiX Supporter)
2005-10-06 03:51 PM
Re: KiXgolf: Fragmentation - Public Coding

So that means the that test is invalid, right?

AllenAdministrator
(KiX Supporter)
2005-10-06 03:54 PM
Re: KiXgolf: Fragmentation - Public Coding

By duplicates, I meant from the input array.

maciep
(Korg Regular)
2005-10-06 03:58 PM
Re: KiXgolf: Fragmentation - Public Coding

The test case is valid. you cannot 0 to 00 and then add 00 to 0 and consider those as different combinations. Yeah, you have two, but they're the same so it's really one. Allen's code sees them as two diff combinations though.

AllenAdministrator
(KiX Supporter)
2005-10-06 04:02 PM
Re: KiXgolf: Fragmentation - Public Coding

ah that sucks... ...

So now I need to figure out why it passed test two when I change the order around.


maciep
(Korg Regular)
2005-10-06 05:48 PM
Re: KiXgolf: Fragmentation - Public Coding

or just change the order around until it fails.

LonkeroAdministrator
(KiX Master Guru)
2005-10-06 07:13 PM
Re: KiXgolf: Fragmentation - Public Coding

and the last correctly working code is?

maciep
(Korg Regular)
2005-10-06 07:15 PM
Re: KiXgolf: Fragmentation - Public Coding

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



--------------------------------------------------------------------------------





LonkeroAdministrator
(KiX Master Guru)
2005-10-06 07:29 PM
Re: KiXgolf: Fragmentation - Public Coding

k, lets take some vodka and think.
I added the modified test 54 as test54b to my ini.


LonkeroAdministrator
(KiX Master Guru)
2005-10-06 07:31 PM
Re: KiXgolf: Fragmentation - Public Coding

Code:
KiXtart Engine
KiXtart Version = 4.50 (WKIX32.EXE)
KiXGolf Script = kixgolf_fragmentation.ki

Computer
OS = Windows 2000 Professiona
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 20:07:45.772
Processing End = 2005/10/06 20:10:12.022
Duration = 0000/00/00 00:02:26.250
Used Processor Time = 00:02:14.573
# Tests Run = 181
# Tests Passed = 181
# Tests Failed = 0
Result = passed
KiXGolf Score = 215

Thank you for participating in KiXtart Golf!
Press any key to continue...


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= ($x[$i] | $x[$j] | $f<>$[$j]+$[$i] | $i=$j)
$c=$c+2
$x[$i]=1
$x[$j]=1
if $c>$u
exit
endfunction



LonkeroAdministrator
(KiX Master Guru)
2005-10-07 12:02 AM
Re: KiXgolf: Fragmentation - Public Coding

as nobody else wants to cut the scores, I guess I have to for the rest of us...

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/07 00:37:52.626
Processing End = 2005/10/07 00:40:11.255
Duration = 0000/00/00 00:02:18.629
Used Processor Time = 00:02:05.931
# Tests Run = 181
# Tests Passed = 181
# Tests Failed = 0
Result = passed
KiXGolf Score = 213

Thank you for participating in KiXtart Golf!
Press any key to continue...


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 1 ^ $x[$i] | $x[$j] | $f<>$[$j]+$[$i] | $i=$j
$c=$c+2
$x[$i]=1
$x[$j]=1
if $c>$u
exit
endfunction



LonkeroAdministrator
(KiX Master Guru)
2005-10-07 04:27 AM
Re: KiXgolf: Fragmentation - Public Coding

heh, I forgot this last cheat.
was playing with it at the time of the previous tournament but never found a place for it.
well, now I did.
behold, my new shortest code:
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/07 04:37:01.429
Processing End = 2005/10/07 04:39:05.817
Duration = 0000/00/00 00:02:04.387
Used Processor Time = 00:02:00.823
# Tests Run = 181
# Tests Passed = 181
# Tests Failed = 0
Result = passed
KiXGolf Score = 212

Thank you for participating in KiXtart Golf!
Press any key to continue...


Code:
Function f($)
dim $u,$i,$j
$u=ubound($)
while 1
dim $x[$u],$c
$f=''
for $j=1 to 2*(0^join($,''))/($u+1)
$f=$f+rnd(1)
next
for $j=0 to $u
for $i=0 to $u
if 1 ^ $x[$i] | $x[$j] | $i=$j | $f<>$[$j]+$[$i]
$c=$c+2
$x[$i]=1
$x[$j]=1
if $c>$u
exit
endfunction



LonkeroAdministrator
(KiX Master Guru)
2005-10-07 05:41 AM
Re: KiXgolf: Fragmentation - Public Coding

just to keep the board alive...
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/07 06:17:53.611
Processing End = 2005/10/07 06:19:52.552
Duration = 0000/00/00 00:01:58.940
Used Processor Time = 00:01:55.766
# Tests Run = 181
# Tests Passed = 181
# Tests Failed = 0
Result = passed
KiXGolf Score = 210


Code:
Function f($u)
dim $,$i,$j
$j=ubound($u)
while 1
dim $x[$j],$c
$f=''
for $=1 to 2*(0^join($u,''))/($j+1)
$f=$f+rnd(1)
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
if $c>$j
exit
endfunction



LonkeroAdministrator
(KiX Master Guru)
2005-10-07 05:57 AM
Re: KiXgolf: Fragmentation - Public Coding

heading to bed, so must post my current score:
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/07 06:33:41.254
Processing End = 2005/10/07 06:35:37.050
Duration = 0000/00/00 00:01:55.795
Used Processor Time = 00:01:48.095
# Tests Run = 181
# Tests Passed = 181
# Tests Failed = 0
Result = passed
KiXGolf Score = 207

Thank you for participating in KiXtart Golf!
Press any key to continue...


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,''))/($j+1)
$f=$f+rnd(1)
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



maciep
(Korg Regular)
2005-10-07 01:54 PM
Re: KiXgolf: Fragmentation - Public Coding

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





MightyR1
(MM club member)
2005-10-07 03:10 PM
Re: KiXgolf: Fragmentation - Public Coding

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



LonkeroAdministrator
(KiX Master Guru)
2005-10-07 11:38 PM
Re: KiXgolf: Fragmentation - Public Coding

fine...
I didn't even enter the college dude, but I ain't a quitter:
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/08 00:14:23.707
Processing End = 2005/10/08 00:16:25.853
Duration = 0000/00/00 00:02:02.146
Used Processor Time = 00:01:49.166
# Tests Run = 181
# Tests Passed = 181
# Tests Failed = 0
Result = passed
KiXGolf Score = 204

Thank you for participating in KiXtart Golf!
Press any key to continue...


Code:
Function f($u)
dim $,$i,$j,$c
$j=ubound($u)
while $c<$j
dim $x[$j]
$f='' $c=0
for $=1 to 0^join($u,'')
$f=$f+rnd(1)
$=$+$j/2
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



NTDOCAdministrator
(KiX Master)
2005-10-08 12:07 AM
Re: KiXgolf: Fragmentation - Public Coding

When you going to break the 200 barrier Jooel?

LonkeroAdministrator
(KiX Master Guru)
2005-10-08 12:09 AM
Re: KiXgolf: Fragmentation - Public Coding

I quess that happens when maciep forces my hand

anyways, he can be the one doing the honors... who knows.


LonkeroAdministrator
(KiX Master Guru)
2005-10-08 12:10 AM
Re: KiXgolf: Fragmentation - Public Coding

and btw, thanks for the code pat.

maciep
(Korg Regular)
2005-10-08 12:41 AM
Re: KiXgolf: Fragmentation - Public Coding

nice catch jooel. I'm not seeing much else left in there to cut out, but who knows. If you stare long enough...

Btw, i award you an honorary minor in math


LonkeroAdministrator
(KiX Master Guru)
2005-10-08 12:46 AM
Re: KiXgolf: Fragmentation - Public Coding

heh, thanks but that math score won't get me any glory outside this board.
thanks anyways.

I already made a script working differently but it only got me to 204 so...
still working on it.


AllenAdministrator
(KiX Supporter)
2005-10-08 12:49 AM
Re: KiXgolf: Fragmentation - Public Coding

Howabout a explaination as to how the hell all that works... especially

Quote:

if 1 ^ $x[$i] | $x[$] | $i=$ | $f<>$u[$]+$u[$i]





LonkeroAdministrator
(KiX Master Guru)
2005-10-08 12:54 AM
Re: KiXgolf: Fragmentation - Public Coding

maciep can go about it, I'm busy.

basically, it's the operand precedence.
the lately added ^ has the lowest precedence there is.
so everything is calculated before it.
then 1 ^ makes it so, only 0 is accepted.

well...
it's pretty simple. you just need to stare it long enough.


LonkeroAdministrator
(KiX Master Guru)
2005-10-08 12:56 AM
Re: KiXgolf: Fragmentation - Public Coding

k, if someone else is working on the kixgolf tester, let me know.
I just added a kixformsVer() system into it.


Chris S.
(MM club member)
2005-10-08 02:09 AM
Re: KiXgolf: Fragmentation - Public Coding

Here is a version of Pat's code chopped down a little...

Code:

KiXtart Engine
KiXtart Version = 4.50
KiXGolf Script = kixgolf_fragmentation.kix

Computer
OS = Windows XP Professional
CPU = Intel(R) Pentium(R) 4 CPU 3.20GHz
Speed = 3192 MHz
Memory = 1024 MB

KiXGolf Scoring Engine
Scoring Engine = 3.0.3

KiXGolf Score
Tournament = Fragmentation
Processing Start = 2005/10/07 19:47:30.273
Processing End = 2005/10/07 19:47:30.820
Duration = 0000/00/00 00:00:00.547
# Tests Run = 180
# Tests Passed = 180
# Tests Failed = 0
Result = passed
KiXGolf Score = 292

Thank you for participating in KiXtart Golf!



Code:

Function F($z)
Dim $m,$l,$i,$j,$,$s,$a,$g,$k,$v
$m=ubound($z)
$l=2*len(join($z,''))/($m+1)
for $i=0 to $m
for $j=0 to $m
$=$z[$i]+$z[$j]
if len($) = $l
$s=$s+#+$
$a=split(substr($s,2),#)
Dim $u
for $k=0 to ubound($a)
if ascan($a,$,$k,1) > -1
$u=1+$u
endif
next
if $v <= $u
$v=$u
for $k=0 to $m
$g=instr($,$z[$k])
next
if $g
$f=$
EndFunction



LonkeroAdministrator
(KiX Master Guru)
2005-10-08 03:12 AM
Re: KiXgolf: Fragmentation - Public Coding

YEHAA!
I quess this does qualify as being under 200!
Code:

KiXtart Engine
KiXtart Version = 4.50 (WKIX32.EXE)
KiXforms Version = 2.46.29.0 / 3.1.17.0
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/08 03:48:36.088
Processing End = 2005/10/08 03:50:08.561
Duration = 0000/00/00 00:01:32.473
Used Processor Time = 00:01:26.664
# Tests Run = 181
# Tests Passed = 181
# Tests Failed = 0
Result = passed
KiXGolf Score = 188

Thank you for participating in KiXtart Golf!
Press any key to continue...


Code:
Function f($u)
dim $i,$j,$c,$x,$
$j=ubound($u)
while $c<$j
$f='' $c=0 $x=$u
for $=1 to 0^join($u,'')
$f=$f+rnd(1)
$=$+$j/2
next
for $=0 to $j
for $i=0 to $j
if $i<>$ & $f=$x[$]+$x[$i]
$c=$c+2
$x[$i]=0
$x[$]=0
Endfunction



maciep
(Korg Regular)
2005-10-08 08:13 PM
Re: KiXgolf: Fragmentation - Public Coding

Brilliant!!!

But since some of the tests contain values of 0, this might be 'safer'

Code:

Function f($u)
dim $i,$j,$c,$x,$
$j=ubound($u)
while $c<$j
$f='' $c=0 $x=$u
for $=1 to 0^join($u,'')
$f=$f+rnd(1)
$=$+$j/2
next
for $=0 to $j
for $i=0 to $j
if $i<>$ & $f=$x[$]+$x[$i]
$c=$c+2
$x[$i]=2
$x[$]=2
Endfunction



LonkeroAdministrator
(KiX Master Guru)
2005-10-08 08:18 PM
Re: KiXgolf: Fragmentation - Public Coding

well...
ideally, yes.
but I haven't found a case where the non-safe code fails, so...


LonkeroAdministrator
(KiX Master Guru)
2005-10-08 11:21 PM
Re: KiXgolf: Fragmentation - Public Coding

been thinking it...
not sure it can fail at all.
basically, if the result should be "10" or "11", it could be fooled.
anyways, haven't tried but if you will, then we know


Sealeopard
(KiX Master)
2005-10-09 02:25 AM
Re: KiXgolf: Fragmentation - Public Coding

Yes, each test has only one valid solution. And changing the order of the file fragments should not break code, either. Regarding Test 54:
'0,00,10,1' can have only '100' as a valid solution. If you get '000' then the other fragemnt would be '101' or '110' which cannot be as all files were identical, now you got two non-identical files. I'll rotate a couple of tests, change the order of fragments. The winning code has to pass this.


Sealeopard
(KiX Master)
2005-10-09 11:14 PM
Re: KiXgolf: Fragmentation - Public Coding

I have added five more tests. A download is available at http://s91376351.onlinehome.us/kixtart/kixgolf_fragmentation.zip

This will be the official test package. Any code that runs through this test package will get valid KiXgolf scores. Modifications to the test package will not be allowed. I will pass the final posted code from all participants through this set.


LonkeroAdministrator
(KiX Master Guru)
2005-10-09 11:47 PM
Re: KiXgolf: Fragmentation - Public Coding

sh*t.
non-responsive test package back.


LonkeroAdministrator
(KiX Master Guru)
2005-10-09 11:50 PM
Re: KiXgolf: Fragmentation - Public Coding

k, my code passed it, huh.
was so scared and couldn't find anything to cut.
Code:

KiXtart Engine
KiXtart Version = 4.51
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/10 00:24:31.666
Processing End = 2005/10/10 00:25:51.911
Duration = 0000/00/00 00:01:20.245
# Tests Run = 185
# Tests Passed = 185
# Tests Failed = 0
Result = passed
KiXGolf Score = 188

Thank you for participating in KiXtart Golf!
Press any key to continue...



AllenAdministrator
(KiX Supporter)
2005-10-10 12:31 AM
Re: KiXgolf: Fragmentation - Public Coding

Well here is my base (with modifications) working with all tests:

Code:
 
function f($)
dim $h,$c,$o,$t,$z
$f=ubound($)
for $c=0 to $f
for $h=$c+1 to $f
$t = a+$[$c]+$[$h]
$z = a+$[$h]+$[$c]
if len($t)=2*len(join($))/($f+1)
$o=$o+$t
if $t<>$z
$o=$o+$z
endif
endif
next
next
for each $ in split($o,a)
$h=ubound(split($o,$))
if $h>$t
$t=$h
$f=$
endfunction



Code:
 
KiXtart Engine
KiXtart Version = 4.51
KiXGolf Script = kixgolf_fragmentation.KIX

Computer
OS = Windows XP Professional
CPU = AMD Athlon(tm) 64 Processor 3200+
Speed = 2002 MHz
Memory = 510 MB

KiXGolf Scoring Engine
Scoring Engine = 3.0.3

KiXGolf Score
Tournament = Fragmentation
Processing Start = 2005/10/09 18:08:36.484
Processing End = 2005/10/09 18:08:36.718
Duration = 0000/00/00 00:00:00.234
# Tests Run = 185
# Tests Passed = 185
# Tests Failed = 0
Result = passed
KiXGolf Score = 241

Thank you for participating in KiXtart Golf!



MightyR1
(MM club member)
2005-10-10 01:34 AM
Re: KiXgolf: Fragmentation - Public Coding

Have been studying the 188 code for a while, but can't figure out the logic.

Is there anyone out there to make things clear?


LonkeroAdministrator
(KiX Master Guru)
2005-10-10 02:14 AM
Re: KiXgolf: Fragmentation - Public Coding

Quote:

Public coding ends Sunday, October 9, 2005, 6pm EST




dang, it's over.

now just waiting jens to announce the winners.


LonkeroAdministrator
(KiX Master Guru)
2005-10-10 02:21 AM
Re: KiXgolf: Fragmentation - Public Coding

patrick, it goes something like:


while not all files matched, loop (the outer while-loop)
randomly pick 0's and 1's to form a string of those elements having the length of the file (the first for-to-next loop)
scan for all possible mixes of the pieces (the 2 inner for loops) and when it matches the randomly selected string (the if), increment the match count. also remove the pieces from the match array so the same pieces won't be accepted multiple times

and that's it.

I think.


LonkeroAdministrator
(KiX Master Guru)
2005-10-10 02:23 AM
Re: KiXgolf: Fragmentation - Public Coding

as a side note, your code I didn't even try to understand and I think I never really understood Maciep's code totally.
guess it's enough for me that I know it's working


MightyR1
(MM club member)
2005-10-10 09:28 AM
Re: KiXgolf: Fragmentation - Public Coding

Jooel,

thanks for the info.

For those interested, here's my logic:

- Get length of the files by calculating the total length of the pieces, times 2, divided by the number of the pieces
- Determine the possible files constructed of the pieces (the 2 outer for's)
- The possible should have the same length as the original file (the length check)
- put all possibles in a 'solution' string
- count the number of times this possible is present in the total solution string
- check if all pieces could be found in the possible

the possible which is most frequent and for which the last check is true, is the right one.

Code:

Function F($)

Dim $m,$i,$j,$g,$k,$l,$u,$v,$a,$s,$p

;get the number of pieces and the length of a file
$m=ubound($)
$l=2*len(join($,''))/($m+1)

;following two 'for' loops is to determine possible files
for $i=0 to $m
for $j=0 to $m

;possible file contructed out of 2 pieces
$p=$[$i]+$[$j]

;if length possible=length file, continue
if len($p) = $l
;put the possible in a string containing all possibles
$s=$s+','+$p
$a=split(substr($s,2),',')

;check how many times possible is present in total string
$u=0
for $k=0 to ubound($a)
if ascan($a,$p,$k,1) >=0
$u=1+$u
endif
next

;if number of this possible >= previous max possible
;check if all pieces could be created from this possible
if $v <= $u
$v=$u
$g=1
;here the check is preformed
for $k=0 to $m
if not instr($p,$[$k])
$g=0
endif
next
;if pieces could be created, this possible is valid
if $g
$f=$p
endif
endif
endif
next
next

EndFunction



Jens,

I know it's too late but what if the input isn't all 0's and 1's?
My code even works () with an input of:

[Test0]
In=MightyR1, Rulez,MightyR1 ,Rulez,Migh,tyR1 Rulez
Out=MightyR1 Rulez

[Test1]
In=1,234567890,12,34567890,0,123456789
Out=1234567890


maciep
(Korg Regular)
2005-10-10 04:17 PM
Re: KiXgolf: Fragmentation - Public Coding

The original code i posted (with all of the arrays) will also work independent on what the test cases are.

Basically, my original code just checks all of different file combinations and keeps track of which pieces were used to create the combinations. And i made sure any file peice would only be used once for a certain combination.

Since there's only once solution possible, i just keep going until I find a combination that used all of the different pieces. That's why that original solution didn't care what the size of the file is - it doesn't really matter.


LonkeroAdministrator
(KiX Master Guru)
2005-10-11 03:04 PM
Re: KiXgolf: Fragmentation - Public Coding

ping pong.

jens?


Sealeopard
(KiX Master)
2005-10-12 06:41 AM
Re: KiXgolf: Fragmentation - Public Coding

Here are the results from both the privateand public coding phase. All submitted code was verified via the 185-test suite.

Private coding:
Jooel wins with a score of 229
Maciep has a score of 225 but fails 8 tests, so no cigar
Allen has a score of 255 and fails one test

Public coding:
Jooel wins the public coding as well with a score of 188
Macipe has submitted a virtually identical code (also 188) that is only modified in two places, however Jooel submitted first.
Next comes Allen with 241, followed by Chris S. with 292 and finally MightyR1 with 337.

Hope you all enjoyed our chemist.

I have not yet set dates for the next round. I do have a challenge but will need some more time to get the package ready and the test cases set up. It will be a two-week challenge from Friday to the following Sunday due to a little more complexity. I'm looking at mid-/late-November for the start. The topic of the next challenge has something to do with Kevin Bacon

BTW, there will be a year-end final ranking of all participants. And even participating will get you points.


LonkeroAdministrator
(KiX Master Guru)
2005-10-12 02:04 PM
Re: KiXgolf: Fragmentation - Public Coding

right judging.
wrong background info though...

maciep's code of 225 didn't make it to the private round.
also the public round follow up sounds little odd...

not bitter or anything... just anal as usual


maciep
(Korg Regular)
2005-10-12 04:17 PM
Re: KiXgolf: Fragmentation - Public Coding

was wondering when my 225 code failed

Congrats to all the golfers!


AllenAdministrator
(KiX Supporter)
2006-02-09 06:45 AM
Re: KiXgolf: Fragmentation - Public Coding

Quote:

I have not yet set dates for the next round. I do have a challenge but will need some more time to get the package ready and the test cases set up. It will be a two-week challenge from Friday to the following Sunday due to a little more complexity. I'm looking at mid-/late-November for the start. The topic of the next challenge has something to do with Kevin Bacon

BTW, there will be a year-end final ranking of all participants. And even participating will get you points.




Jens... isn't about time for another round... and what about those final numbers... while we all know who the winner is... its still interesting to us...er... not quite up to par players... where we stand.


LonkeroAdministrator
(KiX Master Guru)
2006-02-09 08:34 AM
Re: KiXgolf: Fragmentation - Public Coding

yes, is my handicap still over 30?

AllenAdministrator
(KiX Supporter)
2006-02-09 08:51 AM
Re: KiXgolf: Fragmentation - Public Coding

I think you got it backwards... You sir, get no handicap! The handicap is for folks like myself...

30... wise ass (but I'll take anything I can get)


Sealeopard
(KiX Master)
2006-02-11 01:10 PM
Re: KiXgolf: Fragmentation - Public Coding

I know I promised another year-end round. Matter of fact is, real-life intervened and will keep me from doing anyhting KiXtart-related until mid-May. Thus, the planned KiXgolf is baout 50% done but on hold right now.

LonkeroAdministrator
(KiX Master Guru)
2006-02-12 11:50 AM
Re: KiXgolf: Fragmentation - Public Coding

and same goes for the yearly score-card, right?

Sealeopard
(KiX Master)
2006-02-12 02:16 PM
Re: KiXgolf: Fragmentation - Public Coding

I won't promise anything, it's literally a problem of time manament right now and my wife's the one managing my time :-(

LonkeroAdministrator
(KiX Master Guru)
2006-02-12 08:08 PM
Re: KiXgolf: Fragmentation - Public Coding

women...

NTDOCAdministrator
(KiX Master)
2006-02-13 12:25 AM
Re: KiXgolf: Fragmentation - Public Coding

I hear you there.