Benny69
(MM club member)
2006-12-31 12:42 AM
KiXgolf: Human Sort - Public Round

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.


Benny69
(MM club member)
2006-12-31 12:42 AM
Re: KiXgolf: Human Sort - Public Round

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


Gargoyle
(MM club member)
2006-12-31 05:05 AM
Re: KiXgolf: Human Sort - Public Round

Quote:

If b($[$d]) < b($[$c])


You dirty dog .... That is what eluded me the entire challange.. :banghead:


Sealeopard
(KiX Master)
2007-01-01 06:19 AM
Re: KiXgolf: Human Sort - Public Round

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.


Benny69
(MM club member)
2007-01-01 01:11 PM
Re: KiXgolf: Human Sort - Public Round

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


LonkeroAdministrator
(KiX Master Guru)
2007-01-01 03:06 PM
Re: KiXgolf: Human Sort - Public Round

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


LonkeroAdministrator
(KiX Master Guru)
2007-01-01 03:09 PM
Re: KiXgolf: Human Sort - Public Round

and the test results with the 9er ini:
KiXtart Version  = 4.53
KiXGolf Script = kixgolf_humansort.kix

Computer
OS = Windows Vista Enterprise Edition
CPU = Intel Pentium Model 13
Speed = 1866 MHz
Memory = 758 MB

KiXGolf Scoring Engine
Scoring Engine = 3.3

KiXtart Golf Score
Tournament = KiXtart Golf: Human Sort
Processing Start = 2007/01/01 16:07:03.329
Processing End = 2007/01/01 16:07:03.516
Duration = 0000/00/00 00:00:00.187
# Tests Run = 9
# Tests Passed = 9
# Tests Failed = 0
Result = passed
KiXGolf Score = 264


KiXtart Version  = 4.53
KiXGolf Script = kixgolf_humansort.kix

Computer
OS = Windows Vista Enterprise Edition
CPU = Intel Pentium Model 13
Speed = 1866 MHz
Memory = 758 MB

KiXGolf Scoring Engine
Scoring Engine = 3.3

KiXtart Golf Score
Tournament = KiXtart Golf: Human Sort
Processing Start = 2007/01/01 16:08:10.715
Processing End = 2007/01/01 16:08:11.918
Duration = 0000/00/00 00:00:01.203
# Tests Run = 9
# Tests Passed = 9
# Tests Failed = 0
Result = passed
KiXGolf Score = 315


LonkeroAdministrator
(KiX Master Guru)
2007-01-01 03:56 PM
Re: KiXgolf: Human Sort - Public Round

k, here is a stab at benny's code.
gave 228:
KiXtart Version  = 4.53
KiXGolf Script = kixgolf_humansort.kix

Computer
OS = Windows Vista Enterprise Edition
CPU = Intel Pentium Model 13
Speed = 1866 MHz
Memory = 758 MB

KiXGolf Scoring Engine
Scoring Engine = 3.3

KiXtart Golf Score
Tournament = KiXtart Golf: Human Sort
Processing Start = 2007/01/01 16:47:46.026
Processing End = 2007/01/01 16:54:34.528
Duration = 0000/00/00 00:06:48.502
# Tests Run = 9
# Tests Passed = 9
# Tests Failed = 0
Result = passed
KiXGolf Score = 228

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


Benny69
(MM club member)
2007-01-01 05:52 PM
Re: KiXgolf: Human Sort - Public Round

It figures I missed some obvious ones.

LonkeroAdministrator
(KiX Master Guru)
2007-01-01 06:13 PM
Re: KiXgolf: Human Sort - Public Round

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:

KiXtart
KiXtart Version = 4.53
KiXGolf Script = kixgolf_humansort.kix

Computer
OS = Windows Vista Enterprise Edition
CPU = Intel Pentium Model 13
Speed = 1866 MHz
Memory = 758 MB

KiXGolf Scoring Engine
Scoring Engine = 3.3

KiXtart Golf Score
Tournament = KiXtart Golf: Human Sort
Processing Start = 2007/01/01 19:07:39.998
Processing End = 2007/01/01 19:28:26.503
Duration = 0000/00/00 00:20:46.504
# Tests Run = 9
# Tests Passed = 9
# Tests Failed = 0
Result = passed
KiXGolf Score = 209


LonkeroAdministrator
(KiX Master Guru)
2007-01-01 06:24 PM
Re: KiXgolf: Human Sort - Public Round

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


LonkeroAdministrator
(KiX Master Guru)
2007-01-01 06:31 PM
Re: KiXgolf: Human Sort - Public Round

k, so it's 209 now.
updated the code post above with the test result.


Benny69
(MM club member)
2007-01-01 07:28 PM
Re: KiXgolf: Human Sort - Public Round

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


LonkeroAdministrator
(KiX Master Guru)
2007-01-01 07:42 PM
Re: KiXgolf: Human Sort - Public Round

k, change:
If Int($d) > 0

to:
If 0+$d


and it's 231.


Benny69
(MM club member)
2007-01-01 08:09 PM
Re: KiXgolf: Human Sort - Public Round

very creative

Benny69
(MM club member)
2007-01-04 03:17 PM
Re: KiXgolf: Human Sort - Public Round

Is no one else going to post any code?

Gargoyle
(MM club member)
2007-01-04 03:52 PM
Re: KiXgolf: Human Sort - Public Round

I could post my non working code.. But what is the point to that?

JochenAdministrator
(KiX Supporter)
2007-01-04 04:46 PM
Re: KiXgolf: Human Sort - Public Round

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 $&§&$%&%[]


Sealeopard
(KiX Master)
2007-01-09 06:05 AM
Re: KiXgolf: Human Sort - Public Round

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.


AllenAdministrator
(KiX Supporter)
2007-01-09 07:34 AM
Re: KiXgolf: Human Sort - Public Round

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.


LonkeroAdministrator
(KiX Master Guru)
2007-01-09 07:39 AM
Re: KiXgolf: Human Sort - Public Round

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?


Sealeopard
(KiX Master)
2007-01-10 05:14 AM
Re: KiXgolf: Human Sort - Public Round

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.


LonkeroAdministrator
(KiX Master Guru)
2007-01-10 06:58 AM
Re: KiXgolf: Human Sort - Public Round

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?


JochenAdministrator
(KiX Supporter)
2007-01-10 08:43 AM
Re: KiXgolf: Human Sort - Public Round

You and Dale were the only ones posting code, go figure ;\)

AllenAdministrator
(KiX Supporter)
2007-01-10 03:36 PM
Re: KiXgolf: Human Sort - Public Round

Doh!... lol