|
|
|||||||
Since Jens has not already done so, it is now after 6:00pm EST and he has given permission to do so, I hereby Close the Private Round and Open the Public Round. Participants, please post your Private Round code. |
||||||||
|
|
|||||||
With out further adu, here is my surprisingly not so amazing 208 code: Code: Function a($) Dim $c,$d,$e For $c = 0 to UBound($) For $d = $c + 1 to UBound($) If b($[$d]) < b($[$c]) $e = $[$d] $[$d] = $[$c] $[$c] = $e ; EndIf ; Next ; Next $a=$ EndFunction Function b($) Dim $f,$g For $g = Len($) to 99 For $f = 0 to 9 $=Join(Split($,$f),#+$f) ; Next ; Next $b=$ EndFunction |
||||||||
|
|
|||||||
Quote: If b($[$d]) < b($[$c]) You dirty dog .... That is what eluded me the entire challange.. :banghead: |
||||||||
|
|
|||||||
I'm making available two additional test cases in http://s91376351.onlinehome.us/kixtart/kixgolf_humansort.zip Benny69 has used a similar approach to what I and some of my colleagues came up with when we were discussing this particular challenge. Our idea was to prepend numerics with leading zeros to make numeric parts equal in length when comparing two strings with each other. However, Benny's code is insufficient as it has a hard-coded length limit of 99 whereas the challenge clearly states that Quote: the numbers however are almost unconstrained in length . Thus, one of the two additional tests has about 200 characters per string and Benny's solution fails the 200-char test. So, Benny's 208 will not count. |
||||||||
|
|
|||||||
ok had to revert back to an earlier code, this one has no hard-coded length. 240 Code: Function a($) Dim $c,$d,$e,$f $f=Len(Join($)) For $c = 0 to UBound($) For $d = $c + 1 to UBound($) If b($[$d],$f) < b($[$c],$f) $e = $[$d] $[$d] = $[$c] $[$c] = $e EndIf ; Next ; Next $a=$ EndFunction Function b($,$i) Dim $g,$h For $h = Len($) to $i For $g = 0 to 9 $=Join(Split($,$g),#+$g) ; Next ; Next $b=$ EndFunction KiXtart Version = 4.53 KiXGolf Script = kixgolf_humansort.kix Computer OS = Windows XP Professional CPU = Intel(R) Pentium(R) D CPU 2.80GHz Speed = 2793 MHz Memory = 2048 MB KiXGolf Scoring Engine Scoring Engine = 3.3 KiXtart Golf Score Tournament = KiXtart Golf: Human Sort Processing Start = 2007/01/01 05:55:17.703 Processing End = 2007/01/01 06:00:26.781 Duration = 0000/00/00 00:05:09.077 # Tests Run = 9 # Tests Passed = 9 # Tests Failed = 0 Result = passed KiXGolf Score = 240 Thank you for participating in KiXgolf! Press any key to continue... |
||||||||
|
|
|||||||
k, got back home. here are my 2 codes. first the shorter, 264: Code: Function a($) dim $e,$k,$b,$l,$x $a=$ $l = len(join($)) for $e=1 to ubound($) $x=$a[$e-1] for $k=1 to $l $ = substr($x,$k) $b = substr($a[$e],$k) if 0+$+$b and $ and $b $=1.1*(0=$)*$b+$ $b=1.1*$*(0=$b)+$b else $ = left($,1) $b = left($b,1) endif if $<>$b $k = $l if $>$b $a[$e-1] = $a[$e] $a[$e] = $x $e = 0 EndFunction and then the longer that handles any sort of string, no matter what the length. Code: Function a($) dim $e,$k,$b,$l,$z $a=$ for $e=1 to ubound($) $l = len(join($a)) for $k=1 to $l $z=$a[$e-1] $b=c($a[$e],$k) $=c($z,$k) if $<>$b $k = $l $l = len($) - len($b) if ($ and 0.<$b & 0<$l | 0=$) | !>$b | $>$b & $l=0 $a[$e-1] = $a[$e] $a[$e] = $z $e = 0 EndFunction function c($z,$k) dim $ do $c=substr($z,$k+$,1) $=$+1 until !>$c | $c>9 $c=substr($z,$k,$-($>1)) endfunction I don't know why, but I tried benny's way and never got that thingie working. will need to look for it closer... |
||||||||
|
|
|||||||
and the test results with the 9er ini: KiXtart Version = 4.53 KiXtart Version = 4.53 |
||||||||
|
|
|||||||
k, here is a stab at benny's code. gave 228: KiXtart Version = 4.53 Code: Function a($) Dim $c,$d For $c = 0 to UBound($) For $d = $c + 1 to UBound($) If b($[$d],$) < b($[$c],$) $a = $[$d] $[$d] = $[$c] $[$c] = $a EndIf $a=$ EndFunction Function b($,$i) Dim $g,$h For $h = Len($) to Len(Join($i)) For $g = 0 to 9 $=Join(Split($,$g),#+$g) $b=$ EndFunction |
||||||||
|
|
|||||||
It figures I missed some obvious ones. |
||||||||
|
|
|||||||
here is a bit shorter one: Code: Function a($) Dim $c For $c = 1 to UBound($) $a = $[$c-1] If b($a,$) > b($[$c],$) $[$c-1] = $[$c] $[$c] = $a $c = 0 EndIf $a=$ EndFunction Function b($,$i) Dim $g,$h For $h = Len($) to Len(Join($i)) For $g = 0 to 9 $=Join(Split($,$g),#+$g) $b=$ EndFunction running the test now.... [€dit] and here is the result:
|
||||||||
|
|
|||||||
and if that doesn't get done in time (still running) here is one that does: Code: Function a($) Dim $c,$d For $c = 0 to UBound($) For $d = $c + 1 to UBound($) $a = $[$d] If b($a,$) < b($[$c],$) $[$d] = $[$c] $[$c] = $a EndIf $a=$ EndFunction Function b($,$i) Dim $g,$h For $h = Len($) to Len(Join($i)) For $g = 0 to 9 $=Join(Split($,$g),#+$g) $b=$ EndFunction for a score of 225 |
||||||||
|
|
|||||||
k, so it's 209 now. updated the code post above with the test result. |
||||||||
|
|
|||||||
This is another approch that I was working with. KiXtart Version = 4.53 KiXGolf Script = kixgolf_humansort.kix Computer OS = Windows XP Professional CPU = Intel(R) Pentium(R) D CPU 2.80GHz Speed = 2793 MHz Memory = 2048 MB KiXGolf Scoring Engine Scoring Engine = 3.3 KiXtart Golf Score Tournament = KiXtart Golf: Human Sort Processing Start = 2007/01/01 12:25:18.750 Processing End = 2007/01/01 12:25:51.109 Duration = 0000/00/00 00:00:32.358 # Tests Run = 9 # Tests Passed = 9 # Tests Failed = 0 Result = passed KiXGolf Score = 236 Thank you for participating in KiXgolf! Press any key to continue... Code: Function a($) Dim $c For $c = 1 to UBound($) $a = $[$c-1] If b($a,$) > b($[$c],$) $[$c-1] = $[$c] $[$c] = $a $c = 0 EndIf $a=$ EndFunction Function b($,$e) Dim $c,$d While $ $d=Left($,1) If Int($d) > 0 For $c = Len($) to Len(Join($e)) $d=#+$d Next EndIf $=Right($,~) $b=$b+$d EndFunction |
||||||||
|
|
|||||||
k, change: If Int($d) > 0 to: If 0+$d and it's 231. |
||||||||
|
|
|||||||
very creative |
||||||||
|
|
|||||||
Is no one else going to post any code? |
||||||||
|
|
|||||||
I could post my non working code.. But what is the point to that? |
||||||||
|
|
|||||||
Originally Posted By: Benny69 Is no one else going to post any code? Nope Dude, at least not me ... it seems that I am in a total creativity hibernation atm. Haven't had the time to start coding on my own last week and if I look at the already posted ones I only see $&§&$%&%[] |
||||||||
|
|
|||||||
KiXgolf: Human Sort is now closed. Private round scores: Code: 1. Benny69 .. 240 (6+1 points) 2. Jooel .... 315 (5+1 points) Public round scores: Code: 1. Jooel .... 209 (5 points) 2. Benny69 .. 240 (4 points) Standings: Code: 1. Jooel ........... 33 2. Benny69 ......... 18 3. DrillSergeant ... 15 4. Maciep .......... 14 5. Shawn ........... 12 6. RemcovC ......... 10 7. Richard H ....... 3 8. Jochen .......... 2 9. Allen ........... 1 10. Glenn Barnas .... 1 11. Howard Bullock .. 1 12. It_took_my_meds . 1 13. Krabourn ........ 1 14. Witto ........... 1 I am planning to one more for this go-around. However, I do not yet have a timeline. I will also try to keep it simple. I actually thought this one would be simple as everybody would turn to e.g. a bubble-sort algorithm and then come up with an function-style approach to compare each two strings. |
||||||||
|
|
|||||||
While I didn't post any working code, I spent quite a bit of time on this "easy" one, only to get frustrated at every turn. I only hope the next one is so "easy" Didn't Eric have some working code... I wonder why he never posted it. |
||||||||
|
|
|||||||
hmm... next time we need to have the tournaments before the end of year. now, the standings span also this year hey, what are the 6+1 and 5+1 with me and benny? |
||||||||
|
|
|||||||
Every participant gets one point just for participating :-) First to fifth place earns points with first place getting five, independent of whether it's the private or public round. Private round placements earns one additional point. |
||||||||
|
|
|||||||
k, so we don't have the first submission point no more? why do I see only 2 participants in the standings even though there were lots more on the private round? |
||||||||
|
|
|||||||
You and Dale were the only ones posting code, go figure |
||||||||
|
|
|||||||
Doh!... lol |