#164943 - 2006-07-27 07:56 AM
Re: KiXgolf: Mayan Number Converter - Public Phase
|
Benny69
Moderator
Registered: 2003-10-29
Posts: 1036
Loc: Lincoln, Ne
|
Thanks Jens, I really have no intention to use the 149 code and would like to officially remove it from the competition, it was meant more as a joke, and as in the recent discussion it removes from the spirit of the game.
|
Top
|
|
|
|
#164945 - 2006-07-27 09:27 AM
Re: KiXgolf: Mayan Number Converter - Public Phase
|
Richard H.
Administrator
Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
|
Quote:
but think there will be cases in the future that a code runs in 55 minutes on one computer and 1:05 on another and we will have this discussion again.
You could do what you suggested in an earlier post - rather than using real time as a metric, use user cpu cycles. This should be pretty close on main processor lines for the types of challenges that we are undertaking.
You can't include system CPU cycles as these are too easily influenced by whatever else the PC is up to.
Now all you need to do is calculate a reasonable user CPU load for 15 minutes
|
Top
|
|
|
|
#164948 - 2006-07-27 09:40 PM
Re: KiXgolf: Mayan Number Converter - Public Phase
|
Benny69
Moderator
Registered: 2003-10-29
Posts: 1036
Loc: Lincoln, Ne
|
After revisiting my original code I was able to golf it down to 380.
Code:
Function m($i) Dim $a,$b,$c,$d,$,$p If $i=$i+0 $p=20 $a="|",":","." $d=5,2,1 Do $b=$i-$i/$p*$p $=$b/($p/20) If $=0 $m="-"+$m Else For $c = 0 to 2 While $/$d[$c] $m=$a[$c]+$m $=$-$d[$c] Loop Next EndIf $p=$p*20 $i=$i-$b If $i>0 $m=" "+$m EndIf Until $i=0 Else $p=1 $i=Split($i) For $c = UBound($i) to 0 Step-1 $=0 For $b = 1 to Len($i[$c]) $a=SubStr($i[$c],$b,1) $=$+($a=".") $=$+($a=":")*2 $=$+($a="|")*5 Next $m=$m+$*$p $p=$p*20 ;Next EndFunction
|
Top
|
|
|
|
#164949 - 2006-07-27 09:50 PM
Re: KiXgolf: Mayan Number Converter - Public Phase
|
Benny69
Moderator
Registered: 2003-10-29
Posts: 1036
Loc: Lincoln, Ne
|
4 more for 376:
Code:
Function m($i) Dim $a,$b,$c,$d,$,$p If $i=$i+0 $p=20 $a="|",":","." $d=5,2,1 Do $b=$i mod $p $=$b/($p/20) If $=0 $m="-"+$m Else For $c = 0 to 2 While $/$d[$c] $m=$a[$c]+$m $=$-$d[$c] Loop Next EndIf $p=$p*20 $i=$i-$b If $i>0 $m=" "+$m EndIf Until $i=0 Else $p=1 $i=Split($i) For $c = UBound($i) to 0 Step-1 $=0 For $b = 1 to Len($i[$c]) $a=SubStr($i[$c],$b,1) $=$+($a=".") $=$+($a=":")*2 $=$+($a="|")*5 Next $m=$m+$*$p $p=$p*20 ;Next EndFunction
|
Top
|
|
|
|
#164950 - 2006-07-27 10:46 PM
Re: KiXgolf: Mayan Number Converter - Public Phase
|
Shawn
Administrator
Registered: 1999-08-13
Posts: 8611
|
Benny-353
Code:
Function m($i)
Dim $a,$b,$c,$d,$,$p If $i=$i+0 $a="|",":","." $d=5,2,1 Do $b = $i mod 20 If $b=0 $m="-"+$m Else For $c = 0 to 2 While $b/$d[$c] $m=$a[$c]+$m $b=$b-$d[$c] Loop Next EndIf $i = $i/20 If $i $m = " " + $m EndIf Until $i=0 Else $p=1 $i=Split($i) For $c = UBound($i) to 0 Step-1 $=0 For $b = 1 to Len($i[$c]) $a=SubStr($i[$c],$b,1) $=$+($a=".") $=$+($a=":")*2 $=$+($a="|")*5 Next $m=$m+$*$p $p=$p*20 ;Next EndFunction
|
Top
|
|
|
|
#164952 - 2006-07-27 11:27 PM
Re: KiXgolf: Mayan Number Converter - Public Phase
|
Lonkero
KiX Master Guru
Registered: 2001-06-05
Posts: 22346
Loc: OK
|
but, just for the fun of it... 338 Code:
Function m($i)
Dim $a,$b,$c,$d,$ If $i=$i+0 $a="|",":","." $d=5,2,1 Do $ = $i mod 20 If $=0 $m="-"+$m EndIf For $c = 0 to 2 While $/$d[$c] $m=$a[$c]+$m $=$-$d[$c] Loop Next $i = $i/20 If $i $m = " " + $m EndIf Until $i=0 Else $d=1 $i=Split($i) For $c = -UBound($i) to 0 $=0 For $b = 1 to Len($i[-$c]) $a=SubStr($i[-$c],$b,1) $=$+($a=".") $=$+($a=":")*2 $=$+($a="|")*5 Next $m=$m+$d*$ $d=$d*20 EndFunction
|
Top
|
|
|
|
#164953 - 2006-07-27 11:31 PM
Re: KiXgolf: Mayan Number Converter - Public Phase
|
Shawn
Administrator
Registered: 1999-08-13
Posts: 8611
|
Benny-313
Code:
Function m($i)
Dim $a,$b,$c,$d,$ If $i=$i+0 $a="|",":","." $d=5,2,1 Do $b = $i mod 20 If $b=0 $m="-"+$m Else For $c = 0 to 2 While $b/$d[$c] $m=$a[$c]+$m $b=$b-$d[$c] Loop Next EndIf $i = $i/20 If $i $m = " " + $m EndIf Until $i=0 Else For Each $c in Split($i) $=0 For $b = 1 to Len($c) $a=SubStr($c,$b,1) $=$+($a=".") $=$+($a=":")*2 $=$+($a="|")*5 Next $m=$m*20+$ ;Next EndFunction
|
Top
|
|
|
|
#164954 - 2006-07-27 11:35 PM
Re: KiXgolf: Mayan Number Converter - Public Phase
|
Lonkero
KiX Master Guru
Registered: 2001-06-05
Posts: 22346
Loc: OK
|
309 Code:
Function m($i)
Dim $a,$b,$c,$d,$ If $i=$i+0 $a="|",":","." $d=5,2,1 Do $b = $i mod 20 If $b=0 $m="-"+$m Endif For $c = 0 to 2 While $b/$d[$c] $m=$a[$c]+$m $b=$b-$d[$c] Loop Next
$i = $i/20 If $i $m = " " + $m EndIf Until $i=0 Else For Each $c in Split($i) $=0 For $b = 1 to Len($c) $a=SubStr($c,$b,1) $=$+($a=".") $=$+($a=":")*2 $=$+($a="|")*5 Next $m=$m*20+$ ;Next EndFunction
|
Top
|
|
|
|
#164955 - 2006-07-27 11:37 PM
Re: KiXgolf: Mayan Number Converter - Public Phase
|
Shawn
Administrator
Registered: 1999-08-13
Posts: 8611
|
Benny-304
Code:
Function m($i)
Dim $a,$b,$c,$d,$ If $i=$i+0 $a="|",":","." $d=5,2,1 Do $ = $i mod 20 If $=0 $m="-"+$m Endif For $c = 0 to 2 While $/$d[$c] $m=$a[$c]+$m $=$-$d[$c] Loop Next
$i = $i/20 If $i $m = " " + $m EndIf Until $i=0 Else For Each $c in Split($i) $=0 For $b = 1 to Len($c) $a=SubStr($c,$b,1) $=$+($a=".") $=$+($a=":")*2 $=$+($a="|")*5 Next $m=$m*20+$ ;Next EndFunction
|
Top
|
|
|
|
#164956 - 2006-07-27 11:39 PM
Re: KiXgolf: Mayan Number Converter - Public Phase
|
Benny69
Moderator
Registered: 2003-10-29
Posts: 1036
Loc: Lincoln, Ne
|
|
Top
|
|
|
|
#164957 - 2006-07-27 11:42 PM
Re: KiXgolf: Mayan Number Converter - Public Phase
|
Lonkero
KiX Master Guru
Registered: 2001-06-05
Posts: 22346
Loc: OK
|
299Code:
Function m($i)
Dim $b,$c,$d,$ If $i=$i+0 $d=5,2,1 Do $ = $i mod 20 If $=0 $m="-"+$m Endif For $c = 0 to 2 While $/$d[$c] $m=split("| : .")[$c]+$m $=$-$d[$c] Loop Next
$i = $i/20 If $i $m = " " + $m EndIf Until $i=0 Else For Each $c in Split($i) $=0 while $c $b=left($c,1) $c=right($c,~) $=$+($b=".") $=$+($b=":")*2 $=$+($b="|")*5 loop $m=$m*20+$ ;Next EndFunction
|
Top
|
|
|
|
#164958 - 2006-07-27 11:42 PM
Re: KiXgolf: Mayan Number Converter - Public Phase
|
Benny69
Moderator
Registered: 2003-10-29
Posts: 1036
Loc: Lincoln, Ne
|
jooel, you sneeky guy, was just getting ready to post and you snuck right in there
Edited by benny69 (2006-07-27 11:43 PM)
|
Top
|
|
|
|
#164959 - 2006-07-27 11:44 PM
Re: KiXgolf: Mayan Number Converter - Public Phase
|
Lonkero
KiX Master Guru
Registered: 2001-06-05
Posts: 22346
Loc: OK
|
293 Code:
Function m($i)
Dim $b,$c,$d,$ If $i=$i+0 $d=5,2,1 Do $ = $i mod 20 If $=0 $m="-"+$m Endif For $c = 0 to 2 While $/$d[$c] $m=split("| : .")[$c]+$m $=$-$d[$c] Loop Next
$i = $i/20 If $i $m = " " + $m EndIf Until $i=0 Else For Each $c in Split($i) $=0 while $c $b=left($c,1) $c=right($c,~) $=$+($b=".")+($b=":")*2+($b="|")*5 loop $m=$m*20+$ ;Next EndFunction
|
Top
|
|
|
|
Moderator: Arend_, Allen, Jochen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Mart
|
0 registered
and 628 anonymous users online.
|
|
|