Page 1 of 2 12>
Topic Options
#172255 - 2006-12-31 12:42 AM KiXgolf: Human Sort - Public Round
Benny69 Offline
Moderator
*****

Registered: 2003-10-29
Posts: 1036
Loc: Lincoln, Ne
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.
_________________________
Wait don't order yet,... get KiXforms Designer .NET 2.0 (Beta)
KiXforms Designer .NET 2.0 (Beta)

Top
#172256 - 2006-12-31 12:42 AM Re: KiXgolf: Human Sort - Public Round [Re: Benny69]
Benny69 Offline
Moderator
*****

Registered: 2003-10-29
Posts: 1036
Loc: Lincoln, Ne
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
_________________________
Wait don't order yet,... get KiXforms Designer .NET 2.0 (Beta)
KiXforms Designer .NET 2.0 (Beta)

Top
#172259 - 2006-12-31 05:05 AM Re: KiXgolf: Human Sort - Public Round [Re: Benny69]
Gargoyle Offline
MM club member
*****

Registered: 2004-03-09
Posts: 1597
Loc: Valley of the Sun (Arizona, US...
Quote:

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


You dirty dog .... That is what eluded me the entire challange.. :banghead:
_________________________
Today is the tomorrow you worried about yesterday.

Top
#172270 - 2007-01-01 06:19 AM Re: KiXgolf: Human Sort - Public Round [Re: Gargoyle]
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11164
Loc: Boston, MA, USA
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.
_________________________
There are two types of vessels, submarines and targets.

Top
#172271 - 2007-01-01 01:11 PM Re: KiXgolf: Human Sort - Public Round [Re: Sealeopard]
Benny69 Offline
Moderator
*****

Registered: 2003-10-29
Posts: 1036
Loc: Lincoln, Ne
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...
_________________________
Wait don't order yet,... get KiXforms Designer .NET 2.0 (Beta)
KiXforms Designer .NET 2.0 (Beta)

Top
#172274 - 2007-01-01 03:06 PM Re: KiXgolf: Human Sort - Public Round [Re: Benny69]
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
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...
_________________________
!

download KiXnet

Top
#172275 - 2007-01-01 03:09 PM Re: KiXgolf: Human Sort - Public Round [Re: Lonkero]
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
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
_________________________
!

download KiXnet

Top
#172277 - 2007-01-01 03:56 PM Re: KiXgolf: Human Sort - Public Round [Re: Lonkero]
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
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
_________________________
!

download KiXnet

Top
#172286 - 2007-01-01 05:52 PM Re: KiXgolf: Human Sort - Public Round [Re: Lonkero]
Benny69 Offline
Moderator
*****

Registered: 2003-10-29
Posts: 1036
Loc: Lincoln, Ne
It figures I missed some obvious ones.
_________________________
Wait don't order yet,... get KiXforms Designer .NET 2.0 (Beta)
KiXforms Designer .NET 2.0 (Beta)

Top
#172287 - 2007-01-01 06:13 PM Re: KiXgolf: Human Sort - Public Round [Re: Benny69]
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
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


Edited by Jooel (2007-01-01 06:30 PM)
_________________________
!

download KiXnet

Top
#172288 - 2007-01-01 06:24 PM Re: KiXgolf: Human Sort - Public Round [Re: Lonkero]
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
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
_________________________
!

download KiXnet

Top
#172289 - 2007-01-01 06:31 PM Re: KiXgolf: Human Sort - Public Round [Re: Lonkero]
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
k, so it's 209 now.
updated the code post above with the test result.
_________________________
!

download KiXnet

Top
#172290 - 2007-01-01 07:28 PM Re: KiXgolf: Human Sort - Public Round [Re: Lonkero]
Benny69 Offline
Moderator
*****

Registered: 2003-10-29
Posts: 1036
Loc: Lincoln, Ne
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
_________________________
Wait don't order yet,... get KiXforms Designer .NET 2.0 (Beta)
KiXforms Designer .NET 2.0 (Beta)

Top
#172291 - 2007-01-01 07:42 PM Re: KiXgolf: Human Sort - Public Round [Re: Benny69]
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
k, change:
If Int($d) > 0

to:
If 0+$d


and it's 231.
_________________________
!

download KiXnet

Top
#172292 - 2007-01-01 08:09 PM Re: KiXgolf: Human Sort - Public Round [Re: Lonkero]
Benny69 Offline
Moderator
*****

Registered: 2003-10-29
Posts: 1036
Loc: Lincoln, Ne
very creative
_________________________
Wait don't order yet,... get KiXforms Designer .NET 2.0 (Beta)
KiXforms Designer .NET 2.0 (Beta)

Top
#172387 - 2007-01-04 03:17 PM Re: KiXgolf: Human Sort - Public Round [Re: Benny69]
Benny69 Offline
Moderator
*****

Registered: 2003-10-29
Posts: 1036
Loc: Lincoln, Ne
Is no one else going to post any code?
_________________________
Wait don't order yet,... get KiXforms Designer .NET 2.0 (Beta)
KiXforms Designer .NET 2.0 (Beta)

Top
#172390 - 2007-01-04 03:52 PM Re: KiXgolf: Human Sort - Public Round [Re: Benny69]
Gargoyle Offline
MM club member
*****

Registered: 2004-03-09
Posts: 1597
Loc: Valley of the Sun (Arizona, US...
I could post my non working code.. But what is the point to that?
_________________________
Today is the tomorrow you worried about yesterday.

Top
#172396 - 2007-01-04 04:46 PM Re: KiXgolf: Human Sort - Public Round [Re: Benny69]
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
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 $&§&$%&%[]
_________________________



Top
#172558 - 2007-01-09 06:05 AM Re: KiXgolf: Human Sort - Public Round [Re: Jochen]
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11164
Loc: Boston, MA, USA
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.
_________________________
There are two types of vessels, submarines and targets.

Top
#172559 - 2007-01-09 07:34 AM Re: KiXgolf: Human Sort - Public Round [Re: Sealeopard]
Allen Administrator Offline
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4545
Loc: USA
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.

Top
Page 1 of 2 12>


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

Who's Online
0 registered and 248 anonymous users online.
Newest Members
gespanntleuchten, DaveatAdvanced, Paulo_Alves, UsTaaa, xxJJxx
17864 Registered Users

Generated in 0.076 seconds in which 0.024 seconds were spent on a total of 14 queries. Zlib compression enabled.

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