Sealeopard
(KiX Master)
2006-07-22 02:03 PM
KiXgolf: Mayan Number Converter - Public Phase

Gentlemen, the private phase is now closed. Please show your hands, ahem, your code.

The preliminary ranking of the private phase, pending verification of the codes for all participants is as follows:
Code:

1. Jooel --------- 182
2. Shawn --------- 213
3. DrillSergeant - 217
4. Jooel --------- 219
5. Maciep -------- 225
6. Richard H ----- 252
7. Allen --------- 256
8. Howard bullock 285
9. Glenn Barnas -- 337
10. It_took_my_meds 343
11. Jochen -------- 352
12. Benny69-------- 448
13. Krabourn ------ 651



Let the hacking begin...


Sealeopard
(KiX Master)
2006-07-22 02:11 PM
Re: KiXgolf: Mayan Number Converter - Public Phase

This is the submission from Richard Mallesch (it_took_my_meds), which I am posting on his behalf:
Code:

Function m($a)

$l=0,5,2,1,0
$v="|",":",".","-"
$n = 1
If AScan($v,Left($a,1))=-1
Do $ = $a Mod ($n*20)
$a = $a - $
$ = $ / $n
$n = $n * 20
If $
For $q = 1 to 3
While $ / $l[$q]
$m=$v[$q-1]+$m
$=$-$l[$q]
Loop
Next
Else
$m="-"+$m
EndIf
$m=" "+$m
Until $a=0
$m=Trim($m)
Else
$a = " "+$a
While $a
$c=Right($a,1)
$=IIf($c=" ",-$,$+$l[AScan($v,$c)+1])
$a=Left($a,~)
If $<0 Or $c="-"
$m = $m - $n * $
$n = $n * 20
$=0
;EndIf
;Next
;EndIf

EndFunction



Note: The code does not pass the validation as the variables inside the UDF are not declared despite "$iRC=SETOPTION('Explicit','on')" defined in kixgolf_mnc.kix


krabourn
(Hey THIS is FUN)
2006-07-22 02:12 PM
Re: KiXgolf: Mayan Number Converter - Public Phase

Only fitting that the highest scrore be posted first. HAHAHA!!!

Code:
FUNCTION m($)
DIM $a[6], $b, $i, $j, $t, $s, $u
IF InStr(".:|-", SubStr($, 1, 1))
$a = Split($)
$u = UBound($a)
FOR $i = 0 TO $u
$t = 0
FOR $j = 1 TO Len($a[$i])
$b = SubStr($a[$i], $j, 1)
$t = $t + IIf($b = ".", 1, IIf($b = ":", 2, IIf($b = "|", 5, 0)))
NEXT
$s = 1
IF $u - $i
$s = 20
FOR $j = 1 TO $u - $i - 1
$s = $s * 20
NEXT
ENDIF
$m = $m + $s * $t
NEXT
ELSE
DO
IF $ > 19
$s = 1
FOR $i = 1 TO 6
$s = $s * 20
IF $s < $
$j = $i
$t = $s
ENDIF
NEXT
IF $ > 19
FOR $i = 1 TO 20
$s = $t
$s = $s * $i
IF $s <= $
$a[$j] = $i
ENDIF
NEXT
ELSE
$t = $
ENDIF
$ = $ - ($t * $a[$j])
ELSE
$a[0] = $
$ = $ - $
ENDIF
UNTIL $ < 1
FOR $i = 6 TO 0 STEP -1
IF $a[$i] = "" AND $i
REDIM PRESERVE $a[$i - 1]
ELSE
$i = -1
ENDIF
NEXT
FOR EACH $ IN $a
DO
$m = IIf($ > 4, "|", IIf($ > 1, ":", IIf($, ".", "-"))) + $m
$ = $ - IIf($ > 4, 5, IIf($ > 1, 2, IIf($, 1, 0)))
UNTIL $ < 1
$m = " " + $m
NEXT
$m = Trim($m)
ENDIF
ENDFUNCTION



Oop! Guess I was not fast enough.


JochenAdministrator
(KiX Supporter)
2006-07-22 02:19 PM
Re: KiXgolf: Mayan Number Converter - Public Phase

Right,

here's my 352 still with vartype()

Code:

function m($)
dim $a, $b, $c, $p
$a = split('- . : .: :: | .| :| .:| ::| || .|| :|| .:|| ::|| ||| .||| :||| .:||| ::|||')
$p = 64000000, 3200000, 160000, 8000, 400, 20, 1
if vartype($) = 3
for $b = 0 to 6
$c = $p[$b]
$m = iif($ >= $c, trim($m + ' ' + $a[$/$c]), iif($m, $m + " -", $m))
$ = $ - $/$c * $c
next
$m = iif($m, $m, '-')
else
$c = split($)
$ = ubound($c)
for $b = 0 to $
$m = $p[6-$+$b] * ascan($a,$c[$b]) + $m
;next
;endif
endfunction



[edit]
in the make I had a helper udf for power of 20, as well as a programmatic building
of the mayan string; Something like this:
$m = $m + left('.',( $} - $}/5) mod 2 ) + left('::',( $}-5*($}/5))/2) + left('|||',$}/5) + ' '
(where $} = $/${ , and ${ = p(6-$e) in a for 0 to 6)
which was of course too long.
That said, have a very nice weekend gentlemen, see you on monday
[/edit]


Sealeopard
(KiX Master)
2006-07-22 02:23 PM
Re: KiXgolf: Mayan Number Converter - Public Phase

A little comment on the challenge. The Mayan Number Converter basically consists of two transformations. Transformation #1 is the conversion of the Mayan symbols into a decimal number representation. Transformation #2 is a BASE20/BASE10 conversion between the Mayan vigesimal and the decimal numeral system.

A generic Base Converter is available in the UDF Section under BaseConverter() - for base2-base36 conversions


Sealeopard
(KiX Master)
2006-07-22 02:27 PM
Re: KiXgolf: Mayan Number Converter - Public Phase

Current standings after validating the already posted codes.
Code:

1. Jooel --------- 182
2. Shawn --------- 213
3. DrillSergeant - 217
4. Jooel --------- 219
5. Maciep -------- 225
6. Richard H ----- 252
7. Allen --------- 256
8. Howard bullock 285
9. Glenn Barnas -- 337
It_took_my_meds 343 (does not pass validation due to not DIMming variables inside the UDF)
10. Jochen -------- 352 (confirmed)
11. Benny69-------- 448
12. Krabourn ------ 651 (confirmed)



Benny69
(MM club member)
2006-07-22 02:38 PM
Re: KiXgolf: Mayan Number Converter - Public Phase

Here is my 448, the additional UDF 'x($)'is the power calculator and both UDF's were placed between ;!,... ;! so that it was included in the count calc:

Code:

Function m($i)
Dim $a,$b,$c,$,$p

If VarType($i)=8
$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+$*x($p)
$p=$p+1
Next
Else
$p=1
Do
$b=$i-$i/x($p)*x($p)
$=$b/x($p-1)
If $=0
$m="-"+$m
Else
For $c=1 to $/5
$m="|"+$m
$=$-5
Next
For $c=1 to $/2
$m=":"+$m
$=$-2
Next
If $=1
$m="."+$m
$=$-1
EndIf
EndIf
$i=$i-$b
$p=$p+1
If $i>0
$m=" "+$m
EndIf
Until $i=0
EndFunction

Function x($)
Dim $y
$x=1
For $y = 1 to $
$x=$x*20
EndFunction



maciep
(Korg Regular)
2006-07-22 03:16 PM
Re: KiXgolf: Mayan Number Converter - Public Phase

Here's my code for a score of 225

Code:

Function m($)
dim $c,$d,$f
$f = '- . : .: :: | '
$f = split($f+$f+$f)
for $c=6 to 19
$f[$c]=$f[$c-5]+'|'
next
if $+-$=0
do
$m = trim($f[$ mod 20] + ' ' + $m)
$ = $/20
until $=0
else
$ = split($)
for $d = -ubound($) to 0
$m = $m + $c/20 * ascan($f,$[-$d])
$c=$c*20
;next
;endif
EndFunction



ShawnAdministrator
(KiX Supporter)
2006-07-22 03:45 PM
Re: KiXgolf: Mayan Number Converter - Public Phase

My god Eric - our code is almost identical:

My 213 is:

Code:

Function m($)

dim $a,$b,$c

for $b = 1 to 15
$c = split("- . : .: :: | " + $a)
$a = $a + $c[$b] + "| "
next

if $+0=$
$m = $c[$ mod 20]
if $/20
$m = m($/20) + " " + $m
endif
else
$ = split($)
$b = 1
for $a = -ubound($) to 0
$m = $m + $b * ascan($c,$[-$a])
$b = $b * 20
;next
;endif

EndFunction



This is my new public coding submission for a score of 185

Code:

Function m($)

dim $a,$b,$c

for $b = 1 to 15
$c = split("- . : .: :: | " + $a)
$a = $a + $c[$b] + "| "
next

if $+0=$
$m = $c[$ mod 20]
if $/20
$m = m($/20) + " " + $m
endif
else
for each $ in split($)
$m = $m * 20 + ascan($c,$)
;next
;endif

EndFunction



By the way - I am officially protesting Jooels submission of 182. Jens - your going to have to verify it - none of us have time to do it - and if he does win - I figure the public golfing of it would take - like - 100 years !


Howard Bullock
(KiX Supporter)
2006-07-22 03:59 PM
Re: KiXgolf: Mayan Number Converter - Public Phase

285...
Code:
 ; begin Mayan Number Converter
;
;!
Function m($)
dim $a,$b,$c,$p
if $=$+0
do
$b = $ mod 20
$=($-$b)/20

if $b
$a=5,2,1
for each $p in $a
while $b/$p>0
$m=substr(".:zz|",$p,1)+$m
$b=$b-$p
loop
next
else
$m="-"+$m
endif
$m=" "+$m
until $=0
$m=ltrim($m)
else
$c=1
for $a=len($) to 1 step -1
$b=substr($,$a,1)

if $b=" "
$c=$c*20
endif
$m=$c*instr(".:zz|",$b)+$m

EndFunction
;!
;!
; end Mayan Number Converter



Howard Bullock
(KiX Supporter)
2006-07-22 04:23 PM
Re: KiXgolf: Mayan Number Converter - Public Phase

Very elegant Shawn.

Richard H.Administrator
(KiX Supporter)
2006-07-22 04:24 PM
Re: KiXgolf: Mayan Number Converter - Public Phase

This latest challenge was probably more interesting and fun that most of those we've had recently as it lends itself to many different paths to the solution.

I've discovered a few new techniques and tricks that surprised me, world weary old cynic that I am.

Anyhoo, here it is. Not the shortest, but a thing of chiaroscuric beauty none-the-less (in the authors humble opinion )

Code:
; begin Mayan Number Converter
;
;!
Function m($n)
Dim $,$c
If $n=Val($n)
Do
$=$n mod 20
$n=$n/20
Do
$c=($>4)*3+IIf($>1,2,$)
$=$-$c
$m=SubStr("-.:xx|",$c+1,1)+$m
Until $=0
$m=" "+$m
Until $n=0
Else
For Each $ in Split($n)
$m=$m*20
While $
$m=$m+InStr(".:xx|",Left($,1))
$=SubStr($,2)
Loop
Next
EndIf
$m=Trim($m)
EndFunction
;!
;!
; end Mayan Number Converter
; vim600:filetype=kix ai sw=4 ts=4



Howard Bullock
(KiX Supporter)
2006-07-22 04:35 PM
Re: KiXgolf: Mayan Number Converter - Public Phase

Richard, I see we think alike.

AllenAdministrator
(KiX Supporter)
2006-07-22 04:38 PM
Re: KiXgolf: Mayan Number Converter - Public Phase

256

Code:

Function m($)
dim $y,$r,$c
$y=split("- . : .: :: | .| :| .:| ::| || .|| :|| .:|| ::|| ||| .||| :||| .:||| ::|||")
if $+0=$
do
$r=$ mod 20
$m=" "+$y[$r]+$m
$=$/20
until $=0
$m=trim($m)
else
$c=split($)
$=ubound($c)
$r=1
while $>=0
$m=$m+ascan($y,$c[$])*$r
$=$-1
$r=$r*20
; loop
; endif
EndFunction



AllenAdministrator
(KiX Supporter)
2006-07-22 04:42 PM
Re: KiXgolf: Mayan Number Converter - Public Phase

Code:

for $b = 1 to 15
$c = split("- . : .: :: | " + $a)
$a = $a + $c[$b] + "| "
next



Shawn... so simple...yet... I spent hours and never thought of that...


Sealeopard
(KiX Master)
2006-07-22 04:46 PM
Re: KiXgolf: Mayan Number Converter - Public Phase

I'll have to go offline for most of th day. Please continue posting your entreis for the private phase so that I can validate them. And, FYI, I have my own tests, additional combinations that I'm running. Plus, code has to finish within the timeframe for the tournament.

ShawnAdministrator
(KiX Supporter)
2006-07-22 04:47 PM
Re: KiXgolf: Mayan Number Converter - Public Phase

Here's some golf tips for the public round - assuming your going to maybe start with the 185 code:

1) The best opportunity for removing strokes (imho) is here:

Code:

for $b = 1 to 15
$c = split("- . : .: :: | " + $a)
$a = $a + $c[$b] + "| "
next



If anyone can find a shorter way to build a mayan character table - it will be gold.

The other place is here:

Code:

if $+0=$



If anyone can find a shorter numeric check or b) find a similar or shorter way to test for STRING instead. If you can find a string check - then one should be able to flip the code blocks around - probably saving a single stroke on the commented-out nexts and endif's

One word of caution - this here:

Code:

$m = m($/20) + " " + $m



is a recursive call - so things like IIF() will not work. IIF expressions always get evalulated so using them can cause an endless recurse. Of course - thats just been my experience ;o)

-Shawn


ShawnAdministrator
(KiX Supporter)
2006-07-22 04:55 PM
Re: KiXgolf: Mayan Number Converter - Public Phase

More about that table ...

Code:

for $b = 1 to 15
$c = split("- . : .: :: | " + $a)
$a = $a + $c[$b] + "| "
next



If one is able to bring the number of $vars down from 3 to 2 - and still keep the same number of strokes - then one should be able to remove the DIM of the $var - and save like three strokes !

I've been staring at this table for days - with zero luck.

For reference - here is the absolute max way of defining the table:

$c = split("- . : .: :: | .| :| .:| ::| || .|| :|| .:|| ::|| ||| .||| :||| .:||| ::|||")


Richard H.Administrator
(KiX Supporter)
2006-07-22 04:56 PM
Re: KiXgolf: Mayan Number Converter - Public Phase

Quote:

Richard, I see we think alike.




You're not fooling me, I know that you are just another voice in my head and I am the real Howie

Shhhhh! Hush my brother, they are ever listening...


Howard Bullock
(KiX Supporter)
2006-07-22 05:02 PM
Re: KiXgolf: Mayan Number Converter - Public Phase

Why does the following work? Maybe I stayed up too late night and just can't think straight, but why isn't "$" redefined and fail on the next iteration.

Code:
 for each $ in split($) 


Code:
$="1 2 3 4 5"
? Vartypename($)
? $
for each $ in split($)
? $
? Vartypename($)
next
? Vartypename($)
? "$$="+$


The original value of "$" is set to Empty after the loop.


AllenAdministrator
(KiX Supporter)
2006-07-22 05:16 PM
Re: KiXgolf: Mayan Number Converter - Public Phase

Code:

-ubound()



GENIUS...SHEER GENIUS! (spoken in the Tounge of Wile E. Coyote)


ShawnAdministrator
(KiX Supporter)
2006-07-22 05:19 PM
Re: KiXgolf: Mayan Number Converter - Public Phase

idk, I learned that just a few days ago - when we all golfed-down that sample script in the post where Jen's announced this tournament. My guess is the "IN" variable only gets evaluated once ? I suppose once the enum starts - its not valid to change it on the fly - maybe its a oversight on Ruuds part.

AllenAdministrator
(KiX Supporter)
2006-07-22 05:30 PM
Re: KiXgolf: Mayan Number Converter - Public Phase

Oops... mis-quoted Mr. Coyote... this is what he really said...

"BRILLIANCE!!! That's all I can say. Sheer unadulterated BRILLIANCE!"

For you young'ans, the Road Runner (Looney Tunes) was the foil to all of Wile E Coyote's brilliant ideas.


maciep
(Korg Regular)
2006-07-22 07:29 PM
Re: KiXgolf: Mayan Number Converter - Public Phase

Shawn, very nice with that 185 code. That $m = $m * 20 + ascan($c,$) would have never crossed my mind. And i like the way you built out the mayan numbers - i knew there was room for improvement in the way i did it.

By the way, i was trying to get a half recursive solution going last night, but was too sick of staring at the code


ShawnAdministrator
(KiX Supporter)
2006-07-22 08:01 PM
Re: KiXgolf: Mayan Number Converter - Public Phase

I think there is still room for improvment in that mayan table - somehow getting rid of that 3rd $var - but I can't wrap my mind around it. Or shrinking that mayan string somehow and adding some math-magic - idk . Or something totally new and radical more like.

In terms of the recursive - I did try it "both ways" (to and from at same time) ... and it does work - but I found the overhead on the string side to be too big - but then, that was a few days ago ... one might revisit a double-recurse.


DrillSergeant
(MM club member)
2006-07-22 08:24 PM
Re: KiXgolf: Mayan Number Converter - Public Phase

I couldn't wait untill tomorrow to see how the public fase went.

I asked the Doc to post my 217 code but he didn't do it yet, so here it is:
Code:
; begin Mayan Number Converter
;
;!
Function m($)
dim $a
If $+0=$
Do
$a = $ mod 20

$m = trim(iif($a, left('.',$ mod 5 mod 2)+ left('::',$ mod 5/2)+left('|||',$a/5),'-')+' '+$m)

$ = $ / 20
Until $ = 0
Else
While $
$a = instr('-.:__|', left($,1))
$m = iif($a, $m+$a-1, $m*20)
$ = right($,~)
EndFunction
;!
;!
; end Mayan Number Converter



I'll be back tomorrow and join in the public fase to see how we can built the ultimate script together.

I had a lot of fun this week, and you can definetly add me to the list for the next kixgolf (or kixpoker? ) round.


NTDOCAdministrator
(KiX Master)
2006-07-22 08:39 PM
Re: KiXgolf: Mayan Number Converter - Public Phase

Cause I just woke up dude... LOL
 
Well here is the code for (DrillSergeant, Rogier de Jong) he is out of town right
now and asked that I post the code for him.
 

Function m($)
dim $a
If $+0=$
Do
$a = $ mod 20
$m = trim(iif($a,left('.',$ mod 5 mod 2)+left('::',$ mod 5/2)+left('|||',$a/5),'-')+' '+$m)
$ = $ / 20
Until $ = 0
Else
While $
$a = instr('-.:__|', left($,1))
$m = iif($a, $m+$a-1, $m*20)
$ = right($,~)
EndFunction



 
Code:

Mayan Number Converter passed all 60 tests (100% correct)

KiXtart
KiXtart Version = 4.52
KiXGolf Script = kixgolf_mnc.kix

Computer
OS = Windows XP Professional
CPU = AMD Athlon(tm) 64 FX-53 Processor
Speed = 2403 MHz
Memory = 2046 MB

KiXGolf Scoring Engine
Scoring Engine = 3.0.3

KiXtart Golf Score
Tournament = KiXtart Golf: Mayan Number Converter
Processing Start = 2006/07/22 11:36:26.421
Processing End = 2006/07/22 11:36:26.421
Duration = 0000/00/00 00:00:00.000
KiXGolf Score = 217

Thank you for participating in KiXtart Golf!



JochenAdministrator
(KiX Supporter)
2006-07-22 08:53 PM
Re: KiXgolf: Mayan Number Converter - Public Phase

if $+0 = $

God! Why? Arrrghh

Sarge:

$ = right($,~)

wtf?


ShawnAdministrator
(KiX Supporter)
2006-07-22 10:06 PM
Re: KiXgolf: Mayan Number Converter - Public Phase

Cappy, that $ = right($,~) thing ... had to actually run it to figure it out. Its a shorter form of $ = right($,-1). Seems like this:

$ = right("cappy",~)

would return "appy"

That is brilliant.


Gargoyle
(MM club member)
2006-07-22 10:09 PM
Re: KiXgolf: Mayan Number Converter - Public Phase

Well if anything I have learned that I am out of league in this round. Maybe next time...

ShawnAdministrator
(KiX Supporter)
2006-07-22 10:09 PM
Re: KiXgolf: Mayan Number Converter - Public Phase

This aint pretty ... but for a 182 ...

Code:

Function m($)

dim $a,$b,$c

for $b = 1 to 15
$c = split("- . : .: :: | " + $a)
$a = $a + $c[$b] + "| "
next

for each $b in split($)
$m = $m * 20 + ascan($c,$b)
next

if $+0=$
$m = $c[$ mod 20]
if $/20
$m = m($/20) + " " + $m
;endif
;endif

EndFunction



AllenAdministrator
(KiX Supporter)
2006-07-22 10:17 PM
Re: KiXgolf: Mayan Number Converter - Public Phase

Code:
 $ mod 5 mod 2 



Brilliant (Guiness Guy)
Wow!... a mod mod
I'll have to spend some time figuring out what that does. Nice stuff Serg.


ShawnAdministrator
(KiX Supporter)
2006-07-22 10:21 PM
Re: KiXgolf: Mayan Number Converter - Public Phase

A mod mod - from a former Mod.

Glenn BarnasAdministrator
(KiX Supporter)
2006-07-22 10:45 PM
Re: KiXgolf: Mayan Number Converter - Public Phase

Because of the wicked thunderstorms in the northeast US, I was alternately without power or cable/internet for several hours and was unable to post my lowest score of 326. I've included those enhancements as comments in the code, marked by "LATE! -# strokes". Damn weather made us postpone my daughter's 12th birthday party today!

Somebody asked for commented code so they could learn about the logic, so, here's my commented 337-stroke version:
Code:

; begin Mayan Number Converter
;
;!
Function m($) ; - 57 stroke overhead

Dim $_,$C,$D

If VarType($)=8 ; is it a mayan string?

; Mayan to Decimal - 96 strokes
$D=1 ; initial multiplier value

; work from LSD to MSD
For $_=Len($) to 1 Step -1

; get Mayan char value based on string position
; InString will report 1, 2, 5, or 6 (delimiter)
$C=InStr('.:xx| ',SubStr($,$_,1))

If $C=6 ; Delimiter? move to next multiplier power of 20
$D=$D*20
Else ; is a vaid digit value - multipliy by current multiplier value
; and add to running total
$m=$m+$C*$D ; process value
EndIf

Next ; next string character

Else ; or a Decimal Value?

; Decimal to Mayan - 184 strokes
$D=64000000 ; highest divisor value for 7 digits

While $D>=1 ; loop while divisor is greater than 0
;While $D ; LATE! -3 strokes
; divide by max value, result will be between 0 and 19 - a Mayan "Digit"
$C=$/$D $=$ Mod $D

; If not zero, output the Mayan chars that make up this "digit"
If $C
$m=$m+$_+SubStr('.',1,$C Mod 5 Mod 2)+SubStr('::',1,$C Mod 5/2)+SubStr('|||',1,$C/5)
$_=' ' ; inter-digit space after the first one
Else
; if zero, output a zero only if other digits exist, eliminates leading "shells"
If $m $m=$m+' -' EndIf
EndIf

$D=$D/20 ; reduce the divisor by power of 20

Loop

; If no digits were generated, return only a null shell "digit"
$m=IIf($m='','-',$m)
;$m=IIf($m,$m,'-') ; LATE! -3 strokes

EndIf ; LATE! -5 strokes if removed

EndFunction
;!
;!
; end Mayan Number Converter



maciep
(Korg Regular)
2006-07-22 11:00 PM
Re: KiXgolf: Mayan Number Converter - Public Phase

Dang Rogier! A 217 without building out the mayan number...very impressive!

AllenAdministrator
(KiX Supporter)
2006-07-22 11:36 PM
Re: KiXgolf: Mayan Number Converter - Public Phase

Just using the table generator and the -ubound trick dropped my original function by 21 strokes...

Code:
 
;225
Function m($)
dim $y,$r,$c
for $c = 1 to 15
$y = split("- . : .: :: | " + $r)
$r = $r + $y[$c] + "| "
next
if $+0=$
do
$r=$ mod 20
$m=" "+$y[$r]+$m
$=$/20
until $=0
$m=trim($m)
else
$c=split($)
$r=1
for $=-ubound($c) to 0
$m=$m+ascan($y,$c[-$])*$r
$r=$r*20
; next
; endif
EndFunction



Shawn... I've been staring at your 182... how are you trimming the Mayan number?


ShawnAdministrator
(KiX Supporter)
2006-07-22 11:40 PM
Re: KiXgolf: Mayan Number Converter - Public Phase

There is no need to trim ... this

if $/20

gives a hint that there are more characters to come ... and since the " " is only added if there are more chars. There is never that "trailing space" that needs to be trimmed.


Benny69
(MM club member)
2006-07-22 11:53 PM
Re: KiXgolf: Mayan Number Converter - Public Phase

Rogier, I thought my $i-$i/x($p)*x($p) was creative but your mod mod is a thing of beauty. my hat is off to you.

Benny69
(MM club member)
2006-07-23 12:33 AM
Re: KiXgolf: Mayan Number Converter - Public Phase

Rogier,
I liked your code so I just had to play with it, doing away with $a = $ mod 20 saved you 1 stroke, you now have 216.

Code:

Function m($)
Dim $a
If $+0=$
Do
$m = IIf($ mod 20,Left('.',$ mod 5 mod 2)+Left('::',$ mod 5/2)+Left('|||',$ mod 20/5),'-')+' '+$m
$ = $ / 20
Until $ = 0
Else
$a = InStr('-.:__|', Left($,1))
$m = m(IIf($a, $m+$a-1, $m*20))
$ = Right($,~)
EndFunction



Code:

Mayan Number Converter passed all 60 tests (100% correct)

KiXtart
KiXtart Version = 4.52
KiXGolf Script = kixgolf_mnc.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.0.3

KiXtart Golf Score
Tournament = KiXtart Golf: Mayan Number Converter
Processing Start = 2006/07/22 17:39:33.831
Processing End = 2006/07/22 17:39:33.846
Duration = 0000/00/00 00:00:00.014
KiXGolf Score = 216



Sealeopard
(KiX Master)
2006-07-23 05:11 AM
Re: KiXgolf: Mayan Number Converter - Public Phase

After running all submitted codes through my own tester, here's the current results:
Code:

Jooel --------- 182
1. Shawn --------- 185 (confirmed)
2. Shawn --------- 213 (confirmed)
3. DrillSergeant - 217 (confirmed)
Jooel --------- 219
4. Maciep -------- 225 (confirmed)
5. Richard H ----- 252 (confirmed)
6. Allen --------- 256 (confirmed)
7. Howard bullock 285 (confirmed)
8. Glenn Barnas -- 337 (confirmed)
It_took_my_meds 343 (does not pass validation due to not DIMming variables inside the UDF)
9. Jochen -------- 352 (confirmed)
10. Benny69-------- 448 (confirmed)
11. Krabourn ------ 651 (confirmed)


Please note that Jooel has not submitted either of his two solutions, therefore the KiXgolf scores are unconfirmed and thus not reflected in the ranking. As of right now, Shawn would actually be the winner of the private phase.


Sealeopard
(KiX Master)
2006-07-23 05:25 AM
Re: KiXgolf: Mayan Number Converter - Public Phase

And here are the current standing of the public pase, not much has happened, though Shawn was able to improve his own code a bit. Benny69 moved up to 4th place due to his improvements to DrillSergeant's code. Sounds like the hunt is on to improve Shawn's code.
Code:

Jooel --------- 182
1. Shawn --------- 182 (Shawn-185 was reduced by 3 strokes)
2. Shawn --------- 185 (confirmed)
3. Shawn --------- 213 (confirmed)
4. Benny69 ------- 216 (DrillSergeant-217 was reduced by 1 stroke)
5. DrillSergeant - 217
Jooel --------- 219
6. Maciep -------- 225 (confirmed)
7. Allen --------- 225 (Allen-256 was reduced by 21 strokes)
8. Richard H ----- 252 (confirmed)
9. Allen --------- 256 (confirmed)
10. Howard bullock 285 (confirmed)
11. Glenn Barnas -- 337 (confirmed)
It_took_my_meds 343 (does not pass validation due to not DIMming variables inside the UDF)
12. Jochen -------- 352 (confirmed)
13. Benny69-------- 448 (confirmed)
14. Krabourn ------ 651 (confirmed)



JochenAdministrator
(KiX Supporter)
2006-07-23 09:29 AM
Re: KiXgolf: Mayan Number Converter - Public Phase

Quote:

Cappy, that $ = right($,~) thing ... had to actually run it to figure it out. Its a shorter form of $ = right($,-1). Seems like this:

$ = right("cappy",~)

would return "appy"

That is brilliant.




Yes, brilliant. I havn't run it, but still, after you pointed it out, how could one possibly figure that out without having the kixtart source code?
Rogier, what the green heck did you do to find that one, asked Ruud??


Well, my deep respect to all of you.
I started thinking of reducing the mayan string array thing last week, but that was only wishful thinking for me


NTDOCAdministrator
(KiX Master)
2006-07-23 11:03 AM
Re: KiXgolf: Mayan Number Converter - Public Phase

From the manual.

Code:
~ Performs a bit-wise mathematical negation (NOT) operation on a number. 



JochenAdministrator
(KiX Supporter)
2006-07-23 11:22 AM
Re: KiXgolf: Mayan Number Converter - Public Phase

which is ... ehhh .... ~ nothing, or ~ 0, resulting in -1

BRILLIANT !!!

[I for one keep forgetting that ~ is an operator in the mean time ]


ShawnAdministrator
(KiX Supporter)
2006-07-23 11:33 AM
Re: KiXgolf: Mayan Number Converter - Public Phase

KiXGolf Score = 178

Code:

Function m($)

dim $a,$b,$c

for $b = 1 to 15
$c = split("- . : .: :: | " + $a)
$a = $a + $c[$b] + "| "
next

for each $a in split($)
$m = $m * 20 + ascan($c,$a)
if $+0=$
$m = $c[$ mod 20]
if $/20
$m = m($/20) + " " + $m
;endif
;endif
;next

EndFunction



MightyR1
(MM club member)
2006-07-23 01:22 PM
Re: KiXgolf: Mayan Number Converter - Public Phase

Oh boy,
what a codes you guys came up with. Really SUPERB.

Shawn,
nice trick saving 4 strokes...


ShawnAdministrator
(KiX Supporter)
2006-07-23 01:44 PM
Re: KiXgolf: Mayan Number Converter - Public Phase

Thanks Patrick - there's more there to shave - for anyone that wants to re-arrange the code. Can feel it in me bones ;0)

Sealeopard
(KiX Master)
2006-07-23 02:00 PM
Re: KiXgolf: Mayan Number Converter - Public Phase

Current public round ranking
Code:

1. Shawn --------- 178 (Shawn-182 was reduced by 4 strokes)
Jooel --------- 182
2. Shawn --------- 182 (Shawn-185 was reduced by 3 strokes)
3. Shawn --------- 185 (confirmed)
4. Shawn --------- 213 (confirmed)
5. Benny69 ------- 216 (DrillSergeant-217 was reduced by 1 stroke)
6. DrillSergeant - 217
Jooel --------- 219
7. Maciep -------- 225 (confirmed)
8. Allen --------- 225 (Allen-256 was reduced by 21 strokes)
9. Richard H ----- 252 (confirmed)
10. Allen --------- 256 (confirmed)
11. Howard bullock 285 (confirmed)
12. Glenn Barnas -- 337 (confirmed)
It_took_my_meds 343 (does not pass validation due to not DIMming variables inside the UDF)
13. Jochen -------- 352 (confirmed)
14. Benny69-------- 448 (confirmed)
15. Krabourn ------ 651 (confirmed)



ShawnAdministrator
(KiX Supporter)
2006-07-23 02:28 PM
Re: KiXgolf: Mayan Number Converter - Public Phase

KiXGolf Score = 177

Code:

Function m($)

dim $a,$b,$c

for $b = 1 to 15
$c = split("- . : .: :: | " + $a)
$a = $a + $c[$b] + "| "
next

for each $a in split($)
$m = $m * 20 + ascan($c,$a)
if $m<0
$m = $c[$ mod 20]
if $/20
$m = m($/20) + " " + $m
;endif
;endif
;next

EndFunction



Sealeopard
(KiX Master)
2006-07-23 02:55 PM
Re: KiXgolf: Mayan Number Converter - Public Phase

Jeez, what's next, 176.5?

ShawnAdministrator
(KiX Supporter)
2006-07-23 05:01 PM
Re: KiXgolf: Mayan Number Converter - Public Phase

rofl, maybe. Hey - were is Jooel's 182 code ? We should all start golfing that down - to shave much more than a few strokes here and there.

LonkeroAdministrator
(KiX Master Guru)
2006-07-23 06:07 PM
Re: KiXgolf: Mayan Number Converter - Public Phase

sorry boys.
the bachelor party went on a bit longer than they normally do.
I'm not fit to code anything yet but let me find the codes for you...

the 182 code:
Code:

Function m($i)
dim $e, $, $n
if $i=0+$i
do
$ = $i mod 20
do
$n = 3*($>4) + ($>1) + ($>)
$e = substr('-.:__|',1+$n,1) + $e
$ = $ - $n
until $=0
$m = $e + $m
$e = " "
$i = $i/20
until $i=0
else
$m=-1
do $m=$m+1 until $i=m($m)
EndFunction



and the 219:
Code:

Function m($)
dim $e, $i, $n
if $=0+$
do
$i = $ mod 20
$m = split(" . : .: :: -")[iif($i=0,5,$i mod 5)] + left('|||',$i/5) + $e + $m
$e = ' '
$ = $/20
until $=0
else
$i=split($)
$=1
for $n=-ubound($i) to 0
for $e=0 to 19
if $i[-$n]=m($e)
$m = $m + $ * $e
$ = $ * 20
EndFunction



and shawn, no matter how much you protest, the rules are clear.
as long as the code executes in the alloted time, it is fine.
this is not the first golf round when these type of codes are used.
in fact, way back on one golf round the tests were altered by individuals
so these type of codes didn't suffer so much time penalty.


LonkeroAdministrator
(KiX Master Guru)
2006-07-23 06:12 PM
Re: KiXgolf: Mayan Number Converter - Public Phase

and here is 176 code.
Code:

Function m($_)

dim $,$b,$c

for $b = 1 to 15
$c = split("- . : .: :: | " + $)
$ = $ + $c[$b] + "| "
next

for each $ in split($_)
$m = $m * 20 + ascan($c,$)
if $m<0
$m = $c[$_ mod 20]
if $_/20
$m = m($_/20) + " " + $m

EndFunction



ShawnAdministrator
(KiX Supporter)
2006-07-23 06:48 PM
Re: KiXgolf: Mayan Number Converter - Public Phase

hmmmm, are we were allowed to change the names of the parameters ?

Anyway - heres the thing Jooel - by submitting this brute-force kinda code, your basically spoiling the spirit of these games. Now going-forward - in order for anyone to compete with you (me included) - we're going to have to start writing more of this silly stuff.

Do the Perl golf tournaments have this same problem ?

-Shawn


ShawnAdministrator
(KiX Supporter)
2006-07-23 07:26 PM
Re: KiXgolf: Mayan Number Converter - Public Phase

Ok - here's some 173 code:

Code:

Function m($)

dim $a, $b, $c

for $b = 1 to 15
$c = split("- . : .: :: | " + $a)
$a = $a + $c[$b] + "| "
next

if $=0+$
$m = $c[$ mod 20]
if $/20
$m = m($/20) + " " + $m
endif
else
$m=-1
do $m=$m+1 until $=m($m)
EndFunction



ShawnAdministrator
(KiX Supporter)
2006-07-23 07:52 PM
Re: KiXgolf: Mayan Number Converter - Public Phase

I'm posting this 173 on behalf of Rogier (DrillSergeant) ...

Code:

;!
Function m($)

dim $a

if $=0+$
do
$a = $ mod 20
$m = trim(iif($a,left('.',$ mod 5 mod 2)+left('::',$ mod 5/2)+left('|||',$a/5),'-')+' '+$m)
$ = $ / 20
until $ = 0
else
$m=-1
do
$m=$m+1
until $=m($m)
EndFunction
;!



LonkeroAdministrator
(KiX Master Guru)
2006-07-23 07:55 PM
Re: KiXgolf: Mayan Number Converter - Public Phase

did you either one test the codes?
look pretty buggy to me.


ShawnAdministrator
(KiX Supporter)
2006-07-23 08:03 PM
Re: KiXgolf: Mayan Number Converter - Public Phase

This is 167

This one I am submitting on behalf of me, Rogier and Benny ... especially Benny because he found the reduction ...

Code:

Function m($)

if $=0+$
do
;$a = $ mod 20
$m = trim(iif($ mod 20,left('.',$ mod 5 mod 2)+left('::',$ mod 5/2)+left('|||',$ mod 20/5),'-')+' '+$m)
$ = $ / 20
until $ = 0
else
$m=-1
do
$m=$m+1
until $=m($m)
EndFunction



ShawnAdministrator
(KiX Supporter)
2006-07-23 08:11 PM
Re: KiXgolf: Mayan Number Converter - Public Phase

I just want to recap the last three script submissions and credits - Jens will need this info when he validates all three scripts seperately to ensure standings ...

173 Code - Shawn
173 Code - Shawn & Rogier
167 Code - Shawn/Rogier and Benny


ShawnAdministrator
(KiX Supporter)
2006-07-23 08:18 PM
Re: KiXgolf: Mayan Number Converter - Public Phase

Quote:


did you either one test the codes?





Is that in the rules ?


LonkeroAdministrator
(KiX Master Guru)
2006-07-23 09:39 PM
Re: KiXgolf: Mayan Number Converter - Public Phase

sure it is.
Quote:


All provided test cases representing valid Mayan Numbers must be correctly solved in order to have the KiXgolf score count.




your 173, rogiers 173 and your collective 167 all fail that part as you didn't run the test cases.
thus, my 176 still holds.


NTDOCAdministrator
(KiX Master)
2006-07-23 10:53 PM
Re: KiXgolf: Mayan Number Converter - Public Phase

Well all the code under 177 by Shawn is either invalid or takes a long time to run.

I ran Shawn's 177 and it works fine. The others may, but not going to run them for days to see.

I agree with Shawn that it is not appropriate to change the parameter of the function. Your code is supposed to fit "within" the function.


LonkeroAdministrator
(KiX Master Guru)
2006-07-23 11:20 PM
Re: KiXgolf: Mayan Number Converter - Public Phase

not true.
the function is scored in it's whole because you can change it as much as you like as long as it works.
and my 176 works and does run fine and fast.

there is no rule about changing the variable names but as long as there has been kixgolf, as many times the names have been changed by the winning code.

so why would we start changing the rules and well established guidelines just because shawn says so?


ShawnAdministrator
(KiX Supporter)
2006-07-23 11:46 PM
Re: KiXgolf: Mayan Number Converter - Public Phase

Well, I have no intention of running that shit code through all test cases. So I officially withdraw it ... if anyone wants to take it - the lower score is all yours.

So I guess with that said, your back in the lead Jooel.


Sealeopard
(KiX Master)
2006-07-24 04:40 AM
Re: KiXgolf: Mayan Number Converter - Public Phase

Regarding the brute-force approach, this rule pretty much covers it:
Quote:


  • The UDF is expected to finish in a reasonable time, e.g. if it gets started when the challenge opens, it's expected to be finished by the time the challenge closes even on a somewhat slow computer. The UDF has to be valid during the period that the challenge runs.




  • plus I have the ultimate say:
    Quote:


    6) In case of questions about a particular way to count the KiXtart Golf Challenge organizer has the last call.




    We do have a precedence where we allowed a brute-force approach in the CD Sorter challenge.

    However, I am currently running Jooel's initial solution. On a rather fast computer (AMD Athlon 64 X2 3800+), the brute-force approach requires on average 2 seconds to rotate through 10.000 numbers. This highest number I have in my private test cases is ::||| ::||| ::||| ::||| ::||| ::||| ::|||=1279999999. This number alone will require three days to compute. Thus, I believe that this violates the "reasonable time" rule as throwing in a single additional test, e.g. 1279999998 case will make the brute-force approach run well after the conclusion of the public round.

    Therefore the brute-force approaches, while a creative demonstration, will not qualify for valid KiXgolf scores under the "reasonable time" rule.

    Regarding changing the parameters inside the FUNCTION line, there is no rule covering this. I am tending to continue allowiing this as there might be a tournament where one want to add an addtional OPTIONAL parameter into the function call in order to implement some kind of recrsive solution. There is a precedence where I changed the names of the parameters inside the FUNCTION mid-tournament in order to not penalize a recursive solution, thus it's kind-of a precedent.

    After the conclusion of this tournament, I will post the updated rules for discussion.


    NTDOCAdministrator
    (KiX Master)
    2006-07-24 07:48 AM
    Re: KiXgolf: Mayan Number Converter - Public Phase

    Quote:

    6) In case of questions about a particular way to count the KiXtart Golf Challenge organizer has the last call.




    Well I guess that sums it up rather easy.

    Okay, given a bit of a history lesson I'll agree with you on this one Jooel. However being that this was the first one where I even really attempted it and the Function($) EndFunction was supplied I did not think that one could or should modify it.
    However since Jens sees fit to do so that's fine as well, but it should be clearly listed as a possible option in the rules for future games.


    LonkeroAdministrator
    (KiX Master Guru)
    2006-07-24 08:29 AM
    Re: KiXgolf: Mayan Number Converter - Public Phase

    jens, so, you really think you wanna over run our rules in this round?

    you first clearly state that it must finish in time and so it did.
    in fact, the private round was lot longer than the 3 days it took to run the code.

    so, if you disqualify proper working code just because you feel like you have the power to do so, be my guest.
    but don't argue it has anything to do with judging or reason, it's purely personal.


    It_took_my_meds
    (Hey THIS is FUN)
    2006-07-24 08:53 AM
    Re: KiXgolf: Mayan Number Converter - Public Phase

    I for one have learnt a lot from this competition and I take my hat off to all the people who kicked my ass. I would also like to thank Jens for putting on the competition; particularly as he doesn't even get to participate!

    As for this discussion regarding brute force solutions, don't get too worked up about it guys as after all it's just a friendly competition to inspire ideas for coding. That being said, whilst a brute force solution may be shorter it is not something I would use in a normal script and it doesn't inspire me to use different constructs or approaches to algorithms. Shawn's code is both clever and elegant and gets my vote for the best solution.

    Cheers,

    Richard von Mallesch


    DrillSergeant
    (MM club member)
    2006-07-24 08:56 AM
    Re: KiXgolf: Mayan Number Converter - Public Phase

    Now, now, boys, play nice

    First of all, I took benny's 216 and I got one stroke down with the Jooel-trick to define the space after the first mayan number and adding that for the rest. So I got a 215 now.
    Code:
    ; begin Mayan Number Converter
    ;
    ;!
    Function m($)
    dim $a
    If $+0=$
    Do
    $m = iif($ mod 20, left('.',$ mod 5 mod 2)+ left('::',$ mod 5/2)+left('|||',$ mod 20/5),'-')+$a+$m
    $a = ' '
    $ = $ / 20
    Until $ = 0
    Else
    While $
    $a = instr('-.:__|', left($,1))
    $m = iif($a, $m+$a-1, $m*20)
    $ = right($,~)
    EndFunction
    ;!
    ;!
    ; end Mayan Number Converter




    Code:

    Mayan Number Converter passed all 60 tests (100% correct)

    KiXtart
    KiXtart Version = 4.52 Release Candidate 2
    KiXGolf Script = kixgolf_Mnc.kix

    Computer
    OS = Windows XP Professional
    CPU = Intel Pentium Model 13
    Speed = 1595 MHz
    Memory = 478 MB

    KiXGolf Scoring Engine
    Scoring Engine = 3.0.3

    KiXtart Golf Score
    Tournament = KiXtart Golf: Mayan Number Converter
    Processing Start = 2006/07/24 08:38:06.541
    Processing End = 2006/07/24 08:38:06.551
    Duration = 0000/00/00 00:00:00.009
    KiXGolf Score = 215

    Thank you for participating in KiXtart Golf!



    I think I took the ~ trick from a former golf course I've read, or else I've been playing around with all binary operators to see how they would react to different numbers.

    The double mod is a result of golfing down the original code. slashing out variables where-ever I could. If I have time I'll rebuilt the code back to the basics so that it's easier to understand.

    Brute force? For me, that's a bit icky. Besides, it's a coding contest...

    Change variables? I've looked into that too, but it wouldn't have improved my score, or else I would have done it too.

    Recursive function? Damn... should have thought of that too!

    Jens, looking at the setup and preparation for this, I'm guessing you've spend a lot of work on it.

    If there wasn't a perfect test-environment and everything, I prolly wouldn't have even teed off. So in my book, you own the sandbox, and you can change the rules however you seem fit. Thank you for this nice round, and I'm very much looking forward to the next one.


    DrillSergeant
    (MM club member)
    2006-07-24 09:21 AM
    Re: KiXgolf: Mayan Number Converter - Public Phase

    update:
    Benny pm-ed me a beauty of a 211, and with the trick above it's a 210. So this is a Benny/Sarge score
    Code:
    Function m($)
    Dim $a
    If $+0=$
    Do
    $m = Split(" . : .: :: -")[IIf($ mod 20=0,5,$ mod 20 mod 5)] + Left('|||',$ mod 20/5)+$a+$m
    $a = ' '
    $ = $ / 20
    Until $ = 0
    Else
    While $
    $a = InStr('-.:__|', Left($,1))
    $m = IIf($a, $m+$a-1, $m*20)
    $ = Right($,~)
    EndFunction



    DrillSergeant
    (MM club member)
    2006-07-24 09:23 AM
    Re: KiXgolf: Mayan Number Converter - Public Phase

    changed:
    IIf($ mod 20=0,5,$ mod 20 mod 5)
    to

    IIf($ mod 20, $ mod 20 mod 5,5)


    [edit]I saw that benny's solution came looks a lot like Jooel's code, so it's[/edit]

    for a 208 Benny/Jooel/Sarge score.


    Code:
    ; begin Mayan Number Converter
    ;
    ;!
    Function m($)
    Dim $a
    If $+0=$
    Do
    $m = Split(" . : .: :: -")[IIf($ mod 20,$ mod 20 mod 5,5)] + Left('|||',$ mod 20/5)+$a+$m
    $a = ' '
    $ = $ / 20
    Until $ = 0
    Else
    While $
    $a = InStr('-.:__|', Left($,1))
    $m = IIf($a, $m+$a-1, $m*20)
    $ = Right($,~)
    EndFunction

    ;!
    ;!
    ; end Mayan Number Converter




    Code:

    Mayan Number Converter passed all 60 tests (100% correct)

    KiXtart
    KiXtart Version = 4.52 Release Candidate 2
    KiXGolf Script = kixgolf_mnc.kix

    Computer
    OS = Windows XP Professional
    CPU = Intel Pentium Model 13
    Speed = 1595 MHz
    Memory = 478 MB

    KiXGolf Scoring Engine
    Scoring Engine = 3.0.3

    KiXtart Golf Score
    Tournament = KiXtart Golf: Mayan Number Converter
    Processing Start = 2006/07/24 09:21:06.781
    Processing End = 2006/07/24 09:21:06.791
    Duration = 0000/00/00 00:00:00.009
    KiXGolf Score = 208

    Thank you for participating in KiXtart Golf!



    Benny69
    (MM club member)
    2006-07-24 09:25 AM
    Re: KiXgolf: Mayan Number Converter - Public Phase

    Nice!

    DrillSergeant
    (MM club member)
    2006-07-24 01:41 PM
    Re: KiXgolf: Mayan Number Converter - Public Phase

    The need for the double mod got lost somewhere along the line. Since we don't need it anymore:

    Code:
    ; begin Mayan Number Converter
    ;
    ;!
    Function m($)
    Dim $a
    If $+0=$
    Do
    $m = iif($ mod 20, Split(' . : .: ::')[$ mod 5],'-') + Left('|||',$ mod 20/5)+$a+$m
    $a = ' '
    $ = $ / 20
    Until $ = 0
    Else
    While $
    $a = InStr('-.:__|', Left($,1))
    $m = iif($a, $m+$a-1, $m*20)
    $ = Right($,~)
    EndFunction
    ;!
    ;!
    ; end Mayan Number Converter



    for a result of:
    Code:

    Mayan Number Converter passed all 60 tests (100% correct)

    KiXtart
    KiXtart Version = 4.52 Release Candidate 2
    KiXGolf Script = kixgolf_mnc.kix

    Computer
    OS = Windows XP Professional
    CPU = Intel Pentium Model 13
    Speed = 1595 MHz
    Memory = 478 MB

    KiXGolf Scoring Engine
    Scoring Engine = 3.0.3

    KiXtart Golf Score
    Tournament = KiXtart Golf: Mayan Number Converter
    Processing Start = 2006/07/24 13:39:21.692
    Processing End = 2006/07/24 13:39:21.702
    Duration = 0000/00/00 00:00:00.009
    KiXGolf Score = 203

    Thank you for participating in KiXtart Golf!



    ShawnAdministrator
    (KiX Supporter)
    2006-07-24 01:53 PM
    Re: KiXgolf: Mayan Number Converter - Public Phase

    Nice one.

    LonkeroAdministrator
    (KiX Master Guru)
    2006-07-24 05:53 PM
    Re: KiXgolf: Mayan Number Converter - Public Phase

    k, 175.
    Code:

    Function m($_)

    dim $,$b,$c

    for $b = 1 to 15
    $c = split("- . : .: :: | " + $)
    $ = $ + $c[$b] + "| "
    next

    for each $ in split($_)
    $m = $m * 20 + ascan($c,$)
    if $m<0
    $m = $c[$_ mod 20]
    $ = $_/20
    if $
    $m = m($) + " " + $m

    EndFunction


    Code:

    Mayan Number Converter passed all 60 tests (100% correct)

    KiXtart
    KiXtart Version = 4.52 Release Candidate 1
    KiXGolf Script = kixgolf_mnc.kix

    Computer
    OS = Windows XP Professional
    CPU = Intel Pentium Model 13
    Speed = 1866 MHz
    Memory = 760 MB

    KiXGolf Scoring Engine
    Scoring Engine = 3.0.3

    KiXtart Golf Score
    Tournament = KiXtart Golf: Mayan Number Converter
    Processing Start = 2006/07/24 18:52:45.171
    Processing End = 2006/07/24 18:52:45.359
    Duration = 0000/00/00 00:00:00.187
    KiXGolf Score = 175



    ShawnAdministrator
    (KiX Supporter)
    2006-07-24 06:45 PM
    Re: KiXgolf: Mayan Number Converter - Public Phase

    k 174

    Code:

    Function m($a)

    dim $,$b,$c

    for $b = 1 to 15
    $c = split("- . : .: :: | " + $)
    $ = $ + $c[$b] + "| "
    next

    for each $ in split($a)
    $m = $m * 20 + ascan($c,$)
    if $m<0
    $m = $c[$ mod 20]
    $ = $a/20
    if $
    $m = m($) + " " + $m
    ;endif
    ;endif
    ;next

    EndFunction



    Mart
    (KiX Supporter)
    2006-07-24 07:08 PM
    Re: KiXgolf: Mayan Number Converter - Public Phase

    Not to screw up the party but this rule:

    Quote:


    3) Code can be constructed any way you like, as long as it is syntactically correct with KiXtart.





    Clearly says that it should be correct syntax.
    Commenting out the endif’s and the next so that they will not be executed and as far as I know do not get counted by the scoring engine is not correct kix syntax imho.
    Maybe I'm wrong about the scoring engine but it still is not correct kixtart syntax.


    Howard Bullock
    (KiX Supporter)
    2006-07-24 07:38 PM
    Re: KiXgolf: Mayan Number Converter - Public Phase

    Party pooper!

    Mart
    (KiX Supporter)
    2006-07-24 07:43 PM
    Re: KiXgolf: Mayan Number Converter - Public Phase

    LOL
    I didn’t mean to do so but rules are rules. Right?


    LonkeroAdministrator
    (KiX Master Guru)
    2006-07-24 07:55 PM
    Re: KiXgolf: Mayan Number Converter - Public Phase

    well, it has already been proven that the rules don't stand.
    so, it depends on what jens says about it.


    ShawnAdministrator
    (KiX Supporter)
    2006-07-24 08:02 PM
    Re: KiXgolf: Mayan Number Converter - Public Phase

    There's been no rules broken so far. Jens gave his explaination sighting the rules. You got your change-parameter rule verified. I withdrew my crappy scripts because of the rules. So what other rules were broken ?

    By the way - my take on correct syntax is - as long as the interpreter doesn't complain about it - its correct syntax.


    JochenAdministrator
    (KiX Supporter)
    2006-07-24 08:41 PM
    Re: KiXgolf: Mayan Number Converter - Public Phase

    correct I say!

    Incorrect syntax results in syntax errors.
    Commented or left keywords that doesn't result in syntax errors
    may bend the rules not break them


    LonkeroAdministrator
    (KiX Master Guru)
    2006-07-24 09:21 PM
    Re: KiXgolf: Mayan Number Converter - Public Phase

    shawn, he disqualified code qualified by the rules.
    so, it seems he can twist them at will.

    btw, nice find on that 174.
    sad that it don't approve $=$/20 though.


    ShawnAdministrator
    (KiX Supporter)
    2006-07-24 10:17 PM
    Re: KiXgolf: Mayan Number Converter - Public Phase

    Listen man, I apologize for being an asshole. Your one of the best darn scripters out there - it bugs me when you pull these cheap tricks. You got more skills than that man. Sorry buddy.

    LonkeroAdministrator
    (KiX Master Guru)
    2006-07-24 10:20 PM
    Re: KiXgolf: Mayan Number Converter - Public Phase

    well, maybe I ain't as good as you think.
    maybe I just got you fooled.
    maybe those tricks are all that I know.
    but please, don't tell anyone.


    ShawnAdministrator
    (KiX Supporter)
    2006-07-24 11:02 PM
    Re: KiXgolf: Mayan Number Converter - Public Phase

    yeah ok. well if you can "squeeze out" a 173 - that would be real impressive - I'm currently Kixtart constipated.

    ShawnAdministrator
    (KiX Supporter)
    2006-07-25 01:10 AM
    Re: KiXgolf: Mayan Number Converter - Public Phase

    I am drawing a blank here man.

    Sealeopard
    (KiX Master)
    2006-07-25 06:26 AM
    Re: KiXgolf: Mayan Number Converter - Public Phase

    Shawn summed it up regarding correct syntax:
    Quote:


    By the way - my take on correct syntax is - as long as the interpreter doesn't complain about it - its correct syntax.




    The interpreter is not complaining, so why should I

    It's not my fault that KiXtart doesn't check for closing ENDIFs. But if everybody wishes I can submit this as a) a bug report to Ruud to be fixed in the next version, or b) an incorrect description in the KiXtart Manual as ENDIFs are apparently optional. Maybe the corresponding entry should be written as IF...[ELSE]...[ENDIF] to indicate otional ELSE/ENDIF.

    Regarding the brute-force methods, I have Jooels code running on my work-laptop since this morning and that thing is not making much progress. I consider this common business laptop model (IBM T40) as representative of a "somewhat slower" computer.

    And just to make it clear, I have not disallowed brute-force methods outright, maybe one of the next KiXgolf challenges might even use one. What the rule does not allow is excessive run-times to solve the challenge. Three days on a rather fast computer and then extrapolated most likely six days for the complete set of tests is in my mind on the rather excessive side.

    An updated ranking of the public challenge will follow tomorrow.


    LonkeroAdministrator
    (KiX Master Guru)
    2006-07-25 07:42 AM
    Re: KiXgolf: Mayan Number Converter - Public Phase

    jens, you consider 2,8GHz celeron a fast computer?

    and, if you run the code with the test cases you gave us and not your hidden private tests, it will surely finish in time.

    now, if the rule does not allow excessive run-times, you should change the rule to say that.
    as now the rule says "as long as the code finishes inside the phase's alloted time, it's ok"
    and again, 3 days is lot less excessive than what the rule says is allowed.


    Richard H.Administrator
    (KiX Supporter)
    2006-07-25 09:12 AM
    Re: KiXgolf: Mayan Number Converter - Public Phase

    Agreed the run time rule is not very clearly defined.

    I'd suggest setting an explicit run time and hardware - say a maximum of three hours on, ooh I dunno, a 2.8Ghz Celeron

    If you only propose challenges which would reasonably be expected to complete in seconds or minutes a restricted time limit is not going to be onerous.

    Sure, it will mean that some methods cannot be used, but that's part of the challenge - if you try a tricky shot off the fairway over the trees and you land in the lake then you have to accept a dropped shot and try another way around.


    LonkeroAdministrator
    (KiX Master Guru)
    2006-07-25 09:52 AM
    Re: KiXgolf: Mayan Number Converter - Public Phase

    one could also add cpu usage measurement to the score engine and every zillionth tick would increase the score with a penalty of one.

    DrillSergeant
    (MM club member)
    2006-07-25 10:21 AM
    Re: KiXgolf: Mayan Number Converter - Public Phase

    golf rules

    detail

    So Jens could set a time limit as one of the requirements for each specific golf round and penalties for additional time units.


    Quote:

    every zillionth tick would increase the score with a penalty of one.



    Then we would be making computer tweaking part of the game.


    ShawnAdministrator
    (KiX Supporter)
    2006-07-25 02:43 PM
    Re: KiXgolf: Mayan Number Converter - Public Phase

    I applaud Jen's patience here. I mean, if everyone wrote these kinds of scripts - he would need weeks and prolly a server farm to validate these kinds of answers. And I think hes being pretty generous by using a 1.5ghz machine - the official Perl rules site a 100mhz P II as a "somewhat slow computer".

    Having said that - assuming Jooels script finishes in a reasonable time or not - and with Jen's OK - I have no problem sharing the private round 1st place with Jooel - he deserves something.


    maciep
    (Korg Regular)
    2006-07-25 02:57 PM
    Re: KiXgolf: Mayan Number Converter - Public Phase

    Can you share it with me too?

    DrillSergeant
    (MM club member)
    2006-07-25 03:17 PM
    Re: KiXgolf: Mayan Number Converter - Public Phase

    and me?

    LonkeroAdministrator
    (KiX Master Guru)
    2006-07-25 03:25 PM
    Re: KiXgolf: Mayan Number Converter - Public Phase

    not just sure why he needs to re-validate it.
    I already ran the tests...

    and rogier, what you mean computer tweaking?


    DrillSergeant
    (MM club member)
    2006-07-25 03:41 PM
    Re: KiXgolf: Mayan Number Converter - Public Phase

    Quote:

    and rogier, what you mean computer tweaking?




    well... if I have a heavy script that I want to run as fast as possible, I would shut down unnecesery services, stop unneeded processes, etc.

    That would make my script run faster, won't it?


    ShawnAdministrator
    (KiX Supporter)
    2006-07-25 03:43 PM
    Re: KiXgolf: Mayan Number Converter - Public Phase

    According to the rules - wouldn't all long-running scripts need to be independently verified on the target "slow-computer" ? Would that imply that folks with extremely fast machines would have an advantage over others ?

    LonkeroAdministrator
    (KiX Master Guru)
    2006-07-25 04:35 PM
    Re: KiXgolf: Mayan Number Converter - Public Phase

    no, you boys got it wrong.
    the script uses processing time.
    it has nothing to do with the time spent by other processes.

    where was that kixFlop() udf of mine...

    anyways, calculating approximate speed of a computer and then comparing the time spend by the script to run.
    when using huge number of "flops" to add single stroke penalty, it doesn't matter if the speed tester is 110% accurate or not.


    StarwarsKid
    (Seasoned Scripter)
    2006-07-25 06:38 PM
    Re: KiXgolf: Mayan Number Converter - Public Phase

    I'd rather have a bottle in front of me, than a frontal lobotomy...

    LonkeroAdministrator
    (KiX Master Guru)
    2006-07-25 06:40 PM
    Re: KiXgolf: Mayan Number Converter - Public Phase

    k, to show what I mean, I did a edited version of the kixgolf_mnc.kix for you guys to try:
    http://www.kixtart.org/alternative/edited_kixgolf_mnc.zip

    it should add no penalty to your score.
    but if you add sleep 1 or something alike into your script, it should start penalizing.
    currently the "weight" is set to 20 but it can be adjusted as much as one wants...
    well, we/jens would want.


    ShawnAdministrator
    (KiX Supporter)
    2006-07-25 06:43 PM
    Re: KiXgolf: Mayan Number Converter - Public Phase

    If i just copy this new script into my MNC folder, and run it, i get this:

    ERROR : array reference out of bounds!
    Script: E:\mnc\edited_kixgolf_mnc.kix
    Line : 57


    LonkeroAdministrator
    (KiX Master Guru)
    2006-07-25 06:46 PM
    Re: KiXgolf: Mayan Number Converter - Public Phase

    oh, sorry.
    forgot the minor thing.
    the script needs to be same name as the "kixgolf_mnc.ini"

    or alike...
    anyways, backup up your current kixgolf_mnc.kix and replace it with this new edited one.
    when the name is right, it will work.


    LonkeroAdministrator
    (KiX Master Guru)
    2006-07-25 06:59 PM
    Re: KiXgolf: Mayan Number Converter - Public Phase

    oh, and if you do try it, you will most likely notice the "progress" numbering I added there.
    I asked jens to do that a long time ago but as he hasn't, I tend to add it on my own in every scorer.
    if the script runs longer than a second, one needs to know how the progress goes.
    oh, and also added the error reporting lines.
    don't show up on correct code but with failing code it prints out what went wrong.


    LonkeroAdministrator
    (KiX Master Guru)
    2006-07-25 07:00 PM
    Re: KiXgolf: Mayan Number Converter - Public Phase

    k, just realised.
    sleep 1 doesn't burn cpu time
    so, added this after the dim line in 174 code:
    Code:

    for $b=0 to 100000 next



    and got:
    Code:

    Mayan Number Converter passed all 60 tests (100% correct)

    KiXtart
    KiXtart Version = 4.52
    KiXGolf Script = kixgolf_mnc.kix

    Computer
    OS = Windows XP Professional
    CPU = Intel Pentium Model 13
    Speed = 800 MHz
    Memory = 760 MB

    KiXGolf Scoring Engine
    Scoring Engine = 3.0.3

    KiXtart Golf Score
    Tournament = KiXtart Golf: Mayan Number Converter
    Processing Start = 2006/07/25 19:59:54.241
    Processing End = 2006/07/25 19:59:56.054
    Duration = 0000/00/00 00:00:01.813
    TimePenalty = 5,2
    KiXGolf Score = 198 (193+5,2)



    ShawnAdministrator
    (KiX Supporter)
    2006-07-25 07:03 PM
    Re: KiXgolf: Mayan Number Converter - Public Phase

    yeah - i was adding a sleep 1 and getting weird results.

    ShawnAdministrator
    (KiX Supporter)
    2006-07-25 07:05 PM
    Re: KiXgolf: Mayan Number Converter - Public Phase

    I got a 3.5 point penalty for a $b=0 to 1000000 - that seems a little harse i dont know.

    LonkeroAdministrator
    (KiX Master Guru)
    2006-07-25 07:06 PM
    Re: KiXgolf: Mayan Number Converter - Public Phase

    hmm...
    which type of machine you got there?


    ShawnAdministrator
    (KiX Supporter)
    2006-07-25 07:06 PM
    Re: KiXgolf: Mayan Number Converter - Public Phase

    OS = Windows XP Professional
    CPU = Intel Pentium Model 9
    Speed = 1398 MHz
    Memory = 512 MB


    LonkeroAdministrator
    (KiX Master Guru)
    2006-07-25 07:08 PM
    Re: KiXgolf: Mayan Number Converter - Public Phase

    hmm...
    speedstep seems to kick the processortime calculus out the door

    but on the other hand...
    adding lot larger value to the weight evens the odds of that affecting the results.
    changed also the timepenalty udf a little. now the calculation happens after the code is done, so changing cpu speed should not have that much of an effect.
    Code:
    function TimePenalty(optional $in, $weight)
    dim $,$h
    if vartype($in)
    for $h=0 to 100000 next
    $=ProcessorTime()
    for each $h in split("1 2 3")
    $h = "a" + (1 - (0.147 * $h)/27)
    next
    $TimePenalty=(ProcessorTime(,,$in)/ProcessorTime(,,$))/(0+$weight)
    else
    $TimePenalty = ProcessorTime()
    endif
    endfunction



    [edit]
    added some processor pump up code.


    DrillSergeant
    (MM club member)
    2006-07-25 07:17 PM
    Re: KiXgolf: Mayan Number Converter - Public Phase

    so if one second gives you 5.2 penalty points, your original 182 would have given you 216000 * 5.2 = 1123200 penalty points...

    182 + 1123200 = 1123382

    That shouldn't be too hard to beat


    LonkeroAdministrator
    (KiX Master Guru)
    2006-07-25 07:22 PM
    Re: KiXgolf: Mayan Number Converter - Public Phase

    just realised.
    the algorithm I'm using is all wrong.
    or at least it seems to be...

    drill, indeed.
    that's my point for suggesting something like this.


    ShawnAdministrator
    (KiX Supporter)
    2006-07-25 07:27 PM
    Re: KiXgolf: Mayan Number Converter - Public Phase

    Jooel - I am curious - how long were these CD Sorter scripts running in the previous golf challenge ?

    LonkeroAdministrator
    (KiX Master Guru)
    2006-07-25 07:45 PM
    Re: KiXgolf: Mayan Number Converter - Public Phase

    don't remember, but I do remember that we had a golf round back when in which my code took about 2 days to complete.

    anyways, updated the timepenalty udf (and the download zip):
    Code:

    function TimePenalty(optional $in, $weight)
    dim $,$h,$x
    if not vartype($in)
    $=ProcessorTime()
    do $x=$x+1 until 10000000<ProcessorTime(,,$)
    $=ProcessorTime()
    for each $h in split("1 2 3")
    for $x=0 to 70203 next
    $h = "a" + (1 - (0.147 * $h)/27)
    next
    $TimePenalty = ProcessorTime(),ProcessorTime(,,$)
    else
    $TimePenalty=(ProcessorTime(,,$in[0])/$in[1])/(0+$weight)
    endif
    endfunction



    still not always the same score.


    LonkeroAdministrator
    (KiX Master Guru)
    2006-07-25 09:27 PM
    Re: KiXgolf: Mayan Number Converter - Public Phase

    hey, rogier.
    was playing with your code...
    got 202 from it:
    Code:

    Function m($)
    Dim $a
    Do
    If $+0=$
    $m = iif($ mod 20, Split(' . : .: ::')[$ mod 5],'-') + Left('|||',$ mod 20/5)+$a+$m
    $a = ' '
    $ = $ / 20
    Else
    $a = InStr('-.:__|', Left($,1))
    $m = iif($a, $m+$a-1, $m*20)
    $ = Right($,~)
    Endif
    Until $ = 0
    EndFunction



    LonkeroAdministrator
    (KiX Master Guru)
    2006-07-25 09:44 PM
    Re: KiXgolf: Mayan Number Converter - Public Phase

    OH MY!!!

    172

    Code:

    Function m($!)
    dim $,$b,$c

    for $b = 1 to 16
    $c = split("- . : .: :: " + $)
    $ = $ + "| " + $c[$b]
    next

    for each $ in split($!)
    $m = $m * 20 + ascan($c,$)
    if $m<0
    $m = $c[$ mod 20]
    $ = $!/20
    if $
    $m = m($) + ' ' + $m
    EndFunction



    ShawnAdministrator
    (KiX Supporter)
    2006-07-25 09:48 PM
    Re: KiXgolf: Mayan Number Converter - Public Phase

    lol - NICE !

    I was just going to post this variation on Rogier's theme - a 207 - got to see this other one though cripes ...

    Code:

    Function m($)

    dim $a,$t[19]

    if $=$+0
    $m = iif($ mod 20,split(' . : .: ::')[$ mod 5],'-') + left('|||',$ mod 20/5)
    $=$/20
    if $
    $m = m($) + ' ' + $m
    endif
    else
    for $a = 0 to 19
    $t[$a] = m($a)
    next
    for each $a in split($)
    $m = $m * 20 + ascan($t,$a)
    ; next
    ;endif

    EndFunction



    ShawnAdministrator
    (KiX Supporter)
    2006-07-25 09:51 PM
    Re: KiXgolf: Mayan Number Converter - Public Phase

    Nice - you shaved a few off that mayan table. I've been staring at that for days.

    ShawnAdministrator
    (KiX Supporter)
    2006-07-25 10:15 PM
    Re: KiXgolf: Mayan Number Converter - Public Phase

    Here's a Rogier 190

    Code:

    ;!
    Function m($)

    dim $a

    if $=$+0
    $m = iif($ mod 20,split(' . : .: ::')[$ mod 5],'-') + left('|||',$ mod 20/5)
    $=$/20
    if $
    $m = m($) + ' ' + $m
    endif
    else
    for each $ in split($)
    $a = 0
    while m($a)<>$
    $a = $a + 1
    loop
    $m = $m * 20 + $a
    ;next
    ;endif

    EndFunction
    ;!



    LonkeroAdministrator
    (KiX Master Guru)
    2006-07-25 10:16 PM
    Re: KiXgolf: Mayan Number Converter - Public Phase

    me too

    damn it feels good to be back in the game


    LonkeroAdministrator
    (KiX Master Guru)
    2006-07-25 10:18 PM
    Re: KiXgolf: Mayan Number Converter - Public Phase

    well, here is 191 of your rogier-code:
    Code:

    Function m($)

    dim $b

    if $=$+0
    $m = iif($ mod 20,split(' . : .: ::')[$ mod 5],'-') + left('|||',$ mod 20/5)
    $=$/20
    if $
    $m = m($) + ' ' + $m
    endif
    else
    for each $ in split($)
    dim $a
    while m($a)<>$
    $a = $a + 1
    loop
    $m = $m * 20 + $a
    EndFunction



    ShawnAdministrator
    (KiX Supporter)
    2006-07-25 10:19 PM
    Re: KiXgolf: Mayan Number Converter - Public Phase

    Rogier 188

    Code:

    Function m($)

    dim $a

    if $=$+0
    $m = iif($ mod 20,split(' . : .: ::')[$ mod 5],'-') + left('|||',$ mod 20/5)
    $=$/20
    if $
    $m = m($) + ' ' + $m
    endif
    else
    for each $ in split($)
    $a = -1
    do
    $a=$a+1
    until m($a)=$
    $m = $m * 20 + $a
    ;next
    ;endif

    EndFunction



    LonkeroAdministrator
    (KiX Master Guru)
    2006-07-25 10:19 PM
    Re: KiXgolf: Mayan Number Converter - Public Phase

    wtf, here is 186:
    Code:

    Function m($)

    if $=$+0
    $m = iif($ mod 20,split(' . : .: ::')[$ mod 5],'-') + left('|||',$ mod 20/5)
    $=$/20
    if $
    $m = m($) + ' ' + $m
    endif
    else
    for each $ in split($)
    dim $a
    while m($a)<>$
    $a = $a + 1
    loop
    $m = $m * 20 + $a
    EndFunction



    LonkeroAdministrator
    (KiX Master Guru)
    2006-07-25 10:21 PM
    Re: KiXgolf: Mayan Number Converter - Public Phase

    come on, I don't got all night...

    LonkeroAdministrator
    (KiX Master Guru)
    2006-07-25 10:25 PM
    Re: KiXgolf: Mayan Number Converter - Public Phase

    185
    Code:

    Function m($)

    if $<$+0
    for each $ in split($)
    dim $a
    while m($a)<>$
    $a = $a + 1
    loop
    $m = $m * 20 + $a
    next
    else
    $m = iif($ mod 20,split(' . : .: ::')[$ mod 5],'-') + left('|||',$ mod 20/5)
    $=$/20
    if $
    $m = m($) + ' ' + $m
    EndFunction



    LonkeroAdministrator
    (KiX Master Guru)
    2006-07-25 10:32 PM
    Re: KiXgolf: Mayan Number Converter - Public Phase

    hmm...
    wonder where is the latest score table...


    DrillSergeant
    (MM club member)
    2006-07-25 10:46 PM
    Re: KiXgolf: Mayan Number Converter - Public Phase

    Hehehe, this isn't rogier-code. This is freaky jooel-shawn voodoo, and I'm not having any part of it!

    Benny69
    (MM club member)
    2006-07-25 11:11 PM
    Re: KiXgolf: Mayan Number Converter - Public Phase

    Rogier and I can play this game, here is Jooel code 149 :

    Code:

    Function m($)
    If $<$+0
    $m=-1
    Do
    $m=$m+1
    Until $=m($m)
    Else
    $m = IIf($ mod 20,Split(' . : .: ::')[$ mod 5],'-') + Left('|||',$ mod 20/5)
    $=$/20
    If $
    $m = m($) + ' ' + $m
    EndFunction



    ShawnAdministrator
    (KiX Supporter)
    2006-07-25 11:17 PM
    Re: KiXgolf: Mayan Number Converter - Public Phase

    ROFLMAO - what do we do now ?

    Seriously - I want to give Benny credit for this new round of Rogier code ... he was the one that suggested trying a double-sided recursive technique.


    ShawnAdministrator
    (KiX Supporter)
    2006-07-25 11:19 PM
    Re: KiXgolf: Mayan Number Converter - Public Phase

    ... a double-sided recursive technique that doesn't take three days to run I mean.

    Benny69
    (MM club member)
    2006-07-25 11:19 PM
    Re: KiXgolf: Mayan Number Converter - Public Phase

    by my estimation it would take about 7 days to run, but it is all in good fun

    ShawnAdministrator
    (KiX Supporter)
    2006-07-26 04:23 AM
    Re: KiXgolf: Mayan Number Converter - Public Phase - 170

    Arrrrr ... 170

    Code:

    Function m($b)

    dim $,$a

    for $ = 1 to 16
    $a = split("- . : .: :: " + $m)
    $m = $m + "| " + $a[$]
    next

    for each $ in split($b)
    $m = ascan($a,$) + 20 * $m
    if $m<0
    $m = $a[$ mod 20]
    $ = $b/20
    if $
    $m = m($) + " " + $m
    ;endif
    ;endif
    ;next

    EndFunction



    LonkeroAdministrator
    (KiX Master Guru)
    2006-07-26 06:44 AM
    Re: KiXgolf: Mayan Number Converter - Public Phase - 170

    why did I miss that!
    sweet.


    Björn
    (Korg Regular)
    2006-07-26 09:13 AM
    Re: KiXgolf: Mayan Number Converter - Public Phase - 170

    O.o geebus. that's bloody nuts I say. Good work you guys.

    NTDOCAdministrator
    (KiX Master)
    2006-07-26 11:04 AM
    Re: KiXgolf: Mayan Number Converter - Public Phase - 170

    Well then 170 appears to be the lowest working code that operates within mili-seconds.


    Sealeopard
    (KiX Master)
    2006-07-26 01:04 PM
    Re: KiXgolf: Mayan Number Converter - Public Phase - 170

    How about this proposal, we'll create two rankings, one for the algorithmic approach and a second one for the brute-force approach? From a scoring perspecitve, I am considering to award points to the first five people on either list, with brute-force solutions being penalized by a one point reduction. Scoring would then be:
    Code:

    Participation (code posted):
    1 point

    Private round:
    1. 7 points
    2. 6 points
    3. 5 points
    4. 4 points
    5. 3 points

    Public round:
    1. 5 points
    2. 4 points
    3. 3 points
    4. 2 points
    5. 1 points


    A private round place is thus worth two more points than a public round one.

    Comments welcome.


    Björn
    (Korg Regular)
    2006-07-26 01:14 PM
    Re: KiXgolf: Mayan Number Converter - Public Phase - 170

    For me it sounds like no big change. Dunno how good the common knowledge about brute force coding is here, but I'll give for the time being give my 'vote' to this proposal

    LonkeroAdministrator
    (KiX Master Guru)
    2006-07-26 01:27 PM
    Re: KiXgolf: Mayan Number Converter - Public Phase - 170

    first solution doesn't get any more extra points?

    hmm...
    one catch point could be given, so ppl don't hold on to their results for days before the first gets posted.
    imho.


    ShawnAdministrator
    (KiX Supporter)
    2006-07-26 02:10 PM
    Re: KiXgolf: Mayan Number Converter - Public Phase - 170

    I dont like the idea of keeping two rankings - one for algorithmic and one for brute-force. Reason - no matter what the challenge is - even if the brute-force approach takes more code - someone will submit one just to get the easy points.

    Having said that, I dont have a good answer for this brute-force versus algorithmic thing either.


    Björn
    (Korg Regular)
    2006-07-26 02:11 PM
    Re: KiXgolf: Mayan Number Converter - Public Phase - 170

    How about limiting a contestant to one of the rankings?

    Benny69
    (MM club member)
    2006-07-26 02:41 PM
    Re: KiXgolf: Mayan Number Converter - Public Phase - 170

    I don’t think that any of us would use any script that takes days to run, most of us get frustrated with almost any program that does not react within seconds. I think that brute force has its place and if it can be used in practical situations it should be allowed, otherwise there should be penalties for the score that start adding up quickly after 20-30 seconds (the point of frustration).

    DrillSergeant
    (MM club member)
    2006-07-26 02:49 PM
    Re: KiXgolf: Mayan Number Converter - Public Phase - 170

    I agree with benny. Set up a POF limit and penalty points for every time the POF limit is exceeded.

    Rating = strokes + 2^(Run Time/POF limit)


    ShawnAdministrator
    (KiX Supporter)
    2006-07-26 04:29 PM
    Re: KiXgolf: Mayan Number Converter - Public Phase - 170

    I agree with the POF and penalty concept too. It easier said than done though.

    Benny69
    (MM club member)
    2006-07-26 05:19 PM
    Re: KiXgolf: Mayan Number Converter - Public Phase - 170

    i don't think it would be that tough, jooel has been playing with something similar, and i think rogier has the right idea;

    after stop time of script:
    Code:

    If $runtime > $POF
    $strokes = $strokes + 2^($run_time - $POF)
    EndIf



    LonkeroAdministrator
    (KiX Master Guru)
    2006-07-26 05:22 PM
    Re: KiXgolf: Mayan Number Converter - Public Phase - 170

    2 xor (runtime - POF)?

    LonkeroAdministrator
    (KiX Master Guru)
    2006-07-26 05:24 PM
    Re: KiXgolf: Mayan Number Converter - Public Phase

    btw, a note on the brute force thingie.
    my longer code was one too.
    altought it had only a looper of 0 to 19, the basics were the same.


    ShawnAdministrator
    (KiX Supporter)
    2006-07-26 05:31 PM
    Re: KiXgolf: Mayan Number Converter - Public Phase

    Exactly - thats why we have to be careful about the term brute-force. One can argue that the 170 code does a brute-force search for part of the answer (scan mayan table) - versus Rogiers code that is totally algorithmic. The Rogier 185 code uses a brute-force recursive teqhnique.

    DrillSergeant
    (MM club member)
    2006-07-26 05:32 PM
    Re: KiXgolf: Mayan Number Converter - Public Phase

    runtime divided by pof

    Code:

    If $runtime > $POF
    $strokes = $strokes + 2^($run_time / $POF)
    EndIf



    so a POF of 20 secs gives:

    running for 10 secs = 2^(10/20) = 0
    running for 20 secs = 2^(20/20) = 2
    running for 40 secs = 2^(40/20) = 2*2 = 4
    running for 60 secs = 2^(60/20) = 2*2*2 = 8
    etc...


    DrillSergeant
    (MM club member)
    2006-07-26 05:36 PM
    Re: KiXgolf: Mayan Number Converter - Public Phase

    Quote:

    2 xor (runtime - POF)?
    Quote:



    ^ = 2 raised to the power (runtime - POF)

    ShawnAdministrator
    (KiX Supporter)
    2006-07-26 05:43 PM
    Re: KiXgolf: Mayan Number Converter - Public Phase

    What if we set the POF at 15 minutes. If a script took 5 hours to run. What would be the penalty ?

    DrillSergeant
    (MM club member)
    2006-07-26 05:55 PM
    Re: KiXgolf: Mayan Number Converter - Public Phase

    POF 15
    TTR 5 * 60 = 300

    2 ^ (300 / 15) = 1048576

    Not reasonable? it has a POF * 20, that's pretty frustrating... take your 'bad coffee'-annoyance on monday morning and multiply that by 20...


    Benny69
    (MM club member)
    2006-07-26 06:03 PM
    Re: KiXgolf: Mayan Number Converter - Public Phase

    i think that the POF would be set for each tournament depending on what is trying to be accomplished, and as far as 'Brute Force' I see that as any code that in any way or form that counts 1 by 1 until the result is found. if it can be accomplished inside the POF it should be allowed, if it is outside the POF then penalties should be applied.

    LonkeroAdministrator
    (KiX Master Guru)
    2006-07-26 06:29 PM
    Re: KiXgolf: Mayan Number Converter - Public Phase

    ^2 does raise?
    damn, should have realised that mid-round.


    NTDOCAdministrator
    (KiX Master)
    2006-07-26 07:29 PM
    Re: KiXgolf: Mayan Number Converter - Public Phase

    My 2 cents.

    Well I can't speak for everyone as some will disagree, but I think we all participate in one form or another for the fun of it and not all this haggling and disagreement.

    I'm sorry but I just can't see myself bogging down my computer for hours so that I can't really use it for anything else just to have the lowest score because there is no time limit and I really want to win at all costs.

    I would suggest that the challenges be limited to challenges that normal optimized proper coding techniques can complete within 30 minutes on a P4 800Mhz 256MB system.
    Then any Golfing code must complete within 1 hour.
    If your code can not complete within 1 hour then you need to come up with some other type of code.

    This would allow Jens or others to validate entries properly within a reasonable time frame.
    If you had 10 entries of code that took 3 days each to run it would take a month to validate the code which is just not reasonable.

    So - my suggestion is any submitted Golf code must pass the scoring engine and complete within 1 hour period.


    maciep
    (Korg Regular)
    2006-07-26 07:41 PM
    Re: KiXgolf: Mayan Number Converter - Public Phase

    I agree with Doc. 1 hour seems like a reasonable amount of time for any golf challenge. That's probably the simplest solution for the 'brute-force' debate.

    Benny69
    (MM club member)
    2006-07-26 08:11 PM
    Re: KiXgolf: Mayan Number Converter - Public Phase

    POF may not be the way to go, but I do think we all are in agreement that time boundaries need to be set. I think 1 hour is a bit too long, but it is not unreasonable. I do think that the 1 hour time frame should be limited to what I would call a slow machine, say a PIII 800mhz, so if the same code was run on a machine like mine 2.8ghz dual core it should have to take less than 1 hour.

    ShawnAdministrator
    (KiX Supporter)
    2006-07-27 01:13 AM
    Re: KiXgolf: Mayan Number Converter - Public Phase

    I am in complete agreement with Doc.

    NTDOCAdministrator
    (KiX Master)
    2006-07-27 02:17 AM
    Re: KiXgolf: Mayan Number Converter - Public Phase

    Well perhaps we can get input from Jens and Jooel too.

    Over all I would say the 1 hour is too much as well, but I didn't want to seem to be too restrictive in case Jens or whomever sets up a Golf challenge came up with something that legitimately takes maybe 10 minutes or more to run with proper coding techniques.

    If everyone is in agreement then maybe set the maximum time to complete the challenge to 15 minutes.

    The speed and type of the PC to validate the challenge should not be such a big issue either (imho) if it’s going to spoil the spirit of the game.

    The code should complete within the 15 minutes on ANY commercially sold retail computer within the last 2 years that is not bogged down with spyware or is incapacitated in some other form or fashion that would negatively impact it’s normal performance.

    A.) Must pass scoring engine tests
    B.) Must complete script execution within 15 minutes


    I would also like to ask that TRIM be added to the scoring engine code to remove the tab/spaces in the CPU name.


    Benny69
    (MM club member)
    2006-07-27 02:24 AM
    Re: KiXgolf: Mayan Number Converter - Public Phase

    well said Doc

    ShawnAdministrator
    (KiX Supporter)
    2006-07-27 02:48 AM
    Re: KiXgolf: Mayan Number Converter - Public Phase

    Agreed - 15 minutes is about my POF too.

    Sealeopard
    (KiX Master)
    2006-07-27 05:50 AM
    Re: KiXgolf: Mayan Number Converter - Public Phase

    I think the one hour time restriction would be feasible. I do not recall any KiXgolf tournament where the code ran for more than just a couple of minutes, Howard's CD Sorter and Jooels Mayan Numbers excluded. So, going forward, max runtime would be one hour.

    Sealeopard
    (KiX Master)
    2006-07-27 06:08 AM
    Re: KiXgolf: Mayan Number Converter - Public Phase

    List of public round code submissions:
    Code:

    Benny69 ------- 149
    Shawn --------- 167
    Shawn --------- 170
    Jooel --------- 172
    Shawn --------- 173
    Shawn --------- 173
    Shawn --------- 174
    Jooel --------- 175
    Jooel --------- 176
    Shawn --------- 177
    Shawn --------- 178 (Shawn-182 was reduced by 4 strokes)
    Jooel --------- 182
    Shawn --------- 182 (Shawn-185 was reduced by 3 strokes)
    Shawn --------- 185 (confirmed)
    Jooel --------- 185
    Jooel --------- 186
    Shawn --------- 188
    DrillSargeant - 190
    Jooel --------- 191
    DrillSargeant - 203
    Shawn --------- 207
    DrillSargeant - 208
    DrillSargeant - 210
    Shawn --------- 213 (confirmed)
    DrillSargeant 215 (Benny69-216 reduced by 1 stroke)
    Benny69 ------- 216 (DrillSergeant-217 was reduced by 1 stroke)
    DrillSergeant - 217
    Jooel --------- 219
    Maciep -------- 225 (confirmed)
    Allen --------- 225 (Allen-256 was reduced by 21 strokes)
    Richard H ----- 252 (confirmed)
    Allen --------- 256 (confirmed)
    Howard bullock 285 (confirmed)
    Glenn Barnas -- 337 (confirmed)
    It_took_my_meds 343 (does not pass validation due to not DIMming variables inside the UDF)
    Jochen -------- 352 (confirmed)
    Benny69-------- 448 (confirmed)
    Krabourn ------ 651 (confirmed)



    Benny69
    (MM club member)
    2006-07-27 07:56 AM
    Re: KiXgolf: Mayan Number Converter - Public Phase

    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.

    LonkeroAdministrator
    (KiX Master Guru)
    2006-07-27 08:12 AM
    Re: KiXgolf: Mayan Number Converter - Public Phase

    jens, I do remember that in some round I had to reduce the tests by removing the hardest ones in order to be able to run the validator inside couple hours.

    anyway, the one hour limit is ok for me.
    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.


    Richard H.Administrator
    (KiX Supporter)
    2006-07-27 09:27 AM
    Re: KiXgolf: Mayan Number Converter - Public Phase

    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


    NTDOCAdministrator
    (KiX Master)
    2006-07-27 09:41 AM
    Re: KiXgolf: Mayan Number Converter - Public Phase

    SPIRIT guys, SPIRIT

    5 or 15 minutes isn't going to hurt anyone.
    Main idea is that no one has time or inclination to validate anything that runs for hours and hours or even days.


    LonkeroAdministrator
    (KiX Master Guru)
    2006-07-27 12:39 PM
    Re: KiXgolf: Mayan Number Converter - Public Phase

    richie, thanks for the pointer.
    will test as soon as I get some free time.


    Benny69
    (MM club member)
    2006-07-27 09:40 PM
    Re: KiXgolf: Mayan Number Converter - Public Phase

    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



    Benny69
    (MM club member)
    2006-07-27 09:50 PM
    Re: KiXgolf: Mayan Number Converter - Public Phase

    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



    ShawnAdministrator
    (KiX Supporter)
    2006-07-27 10:46 PM
    Re: KiXgolf: Mayan Number Converter - Public Phase

    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



    LonkeroAdministrator
    (KiX Master Guru)
    2006-07-27 11:16 PM
    Re: KiXgolf: Mayan Number Converter - Public Phase

    sorry shawn but your code results in 353

    LonkeroAdministrator
    (KiX Master Guru)
    2006-07-27 11:27 PM
    Re: KiXgolf: Mayan Number Converter - Public Phase

    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



    ShawnAdministrator
    (KiX Supporter)
    2006-07-27 11:31 PM
    Re: KiXgolf: Mayan Number Converter - Public Phase

    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



    LonkeroAdministrator
    (KiX Master Guru)
    2006-07-27 11:35 PM
    Re: KiXgolf: Mayan Number Converter - Public Phase

    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



    ShawnAdministrator
    (KiX Supporter)
    2006-07-27 11:37 PM
    Re: KiXgolf: Mayan Number Converter - Public Phase

    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



    Benny69
    (MM club member)
    2006-07-27 11:39 PM
    Re: KiXgolf: Mayan Number Converter - Public Phase

    hehee, you guys rock

    LonkeroAdministrator
    (KiX Master Guru)
    2006-07-27 11:42 PM
    Re: KiXgolf: Mayan Number Converter - Public Phase

    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



    Benny69
    (MM club member)
    2006-07-27 11:42 PM
    Re: KiXgolf: Mayan Number Converter - Public Phase

    jooel, you sneeky guy, was just getting ready to post and you snuck right in there


    LonkeroAdministrator
    (KiX Master Guru)
    2006-07-27 11:44 PM
    Re: KiXgolf: Mayan Number Converter - Public Phase

    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



    ShawnAdministrator
    (KiX Supporter)
    2006-07-27 11:46 PM
    Re: KiXgolf: Mayan Number Converter - Public Phase

    woah woah - lets stop for a sec ... looking at jooels last change ...

    ok - its still benny code - this script should keep its general strategy here i think eh ?


    ShawnAdministrator
    (KiX Supporter)
    2006-07-27 11:48 PM
    Re: KiXgolf: Mayan Number Converter - Public Phase

    damn - i have to go for dinner - just when I was having the best time - catch up later.

    LonkeroAdministrator
    (KiX Master Guru)
    2006-07-27 11:49 PM
    Re: KiXgolf: Mayan Number Converter - Public Phase

    well, same code, right?

    oh, you mean the loosing of the for next?


    LonkeroAdministrator
    (KiX Master Guru)
    2006-07-27 11:50 PM
    Re: KiXgolf: Mayan Number Converter - Public Phase

    k, it's back in.
    295
    Code:

    Function m($i)

    Dim $a,$b,$c,$

    If $i=$i+0
    $a="|",":","."
    $b=5,2,1
    Do
    $ = $i mod 20
    If $=0
    $m="-"+$m
    Endif
    For $c = 0 to 2
    While $/$b[$c]
    $m=$a[$c]+$m
    $=$-$b[$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+$
    EndFunction



    LonkeroAdministrator
    (KiX Master Guru)
    2006-07-27 11:52 PM
    Re: KiXgolf: Mayan Number Converter - Public Phase

    hey guys, stop deleting your damn posts.

    Benny69
    (MM club member)
    2006-07-27 11:54 PM
    Re: KiXgolf: Mayan Number Converter - Public Phase

    hehee, i keep posting and you beat me to a better post

    ShawnAdministrator
    (KiX Supporter)
    2006-07-28 12:25 AM
    Re: KiXgolf: Mayan Number Converter - Public Phase

    It started to look like Rogiers code there - with the Left() Right() thingy.

    ShawnAdministrator
    (KiX Supporter)
    2006-07-28 12:27 AM
    Re: KiXgolf: Mayan Number Converter - Public Phase

    I dont know - your variation of the left right thingy looked pretty unique.

    ShawnAdministrator
    (KiX Supporter)
    2006-07-28 12:47 AM
    Re: KiXgolf: Mayan Number Converter - Public Phase

    hmmm, this is kinda ugly eh ?

    $a=split("5 2 1 | : .")

    it really doesn't save anything i think anyways


    LonkeroAdministrator
    (KiX Master Guru)
    2006-07-28 12:53 AM
    Re: KiXgolf: Mayan Number Converter - Public Phase

    hmm...
    this starts to look little like my udf
    anyways...
    264 evolution:
    Code:

    Function m($)

    Dim $a,$b,$d
    $a=".:__|"
    If $=$+0
    Do
    $d = $ mod 20
    If $d=0
    $m="-"+$m
    Endif
    $b=5
    while $b
    While $d/$b
    $m=substr($a,$b,1)+$m
    $d=$d-$b
    Loop
    $b=$b/2
    loop

    $ = $/20
    If $
    $m = " " + $m
    EndIf
    Until $=0
    Else
    For Each $ in Split($)
    $d=0
    For $b = 1 to Len($)
    $d=$d+instr($a,SubStr($,$b,1))
    Next
    $m=$m*20+$d
    EndFunction



    ShawnAdministrator
    (KiX Supporter)
    2006-07-28 12:56 AM
    Re: KiXgolf: Mayan Number Converter - Public Phase

    $b=$b/2

    Brilliant.


    ShawnAdministrator
    (KiX Supporter)
    2006-07-28 01:05 AM
    Re: KiXgolf: Mayan Number Converter - Public Phase

    Ok - I jumped at the easy recurse ...

    Benny-259

    Code:

    Function m($)

    Dim $a,$b,$d
    $a=".:__|"
    If $=$+0
    $d = $ mod 20
    If $d=0
    $m="-"+$m
    Endif
    $b=5
    while $b
    While $d/$b
    $m=substr($a,$b,1)+$m
    $d=$d-$b
    Loop
    $b=$b/2
    loop

    $ = $/20
    If $
    $m = m($) + " " + $m
    EndIf
    Else
    For Each $ in Split($)
    $d=0
    For $b = 1 to Len($)
    $d=$d+instr($a,SubStr($,$b,1))
    Next
    $m=$m*20+$d
    EndFunction



    LonkeroAdministrator
    (KiX Master Guru)
    2006-07-28 07:39 AM
    Re: KiXgolf: Mayan Number Converter - Public Phase

    just for 5 strokes?

    LonkeroAdministrator
    (KiX Master Guru)
    2006-07-28 07:51 AM
    Re: KiXgolf: Mayan Number Converter - Public Phase

    227 then.
    Code:

    Function m($b)

    Dim $a,$,$d
    $a=".:__|"
    If $b=$b+0
    $ = $b mod 20
    If $=0
    $m="-"+$m
    Endif
    $d=5
    while $d
    While $/$d
    $m=substr($a,$d,1)+$m
    $=$-$d
    Loop
    $d=$d/2
    loop
    $ = $b/20
    If $
    $m =m($) + " " + $m
    EndIf
    Else
    For Each $ in Split($b)
    For $b = 0 to 19
    if m($b) = $
    $m=$m*20+$b
    EndFunction



    Gargoyle
    (MM club member)
    2006-07-28 08:16 AM
    Re: KiXgolf: Mayan Number Converter - Public Phase

    Only one comment here....
    Jooel - Shawn.... do you each have stock...


    Sealeopard
    (KiX Master)
    2006-07-29 05:22 AM
    Re: KiXgolf: Mayan Number Converter - Public Phase

    Sounds like we've reached the final point. Looks like both Shawn and Jooel have optimized their code until there's barely anything left of it.

    LonkeroAdministrator
    (KiX Master Guru)
    2006-07-30 09:49 PM
    Re: KiXgolf: Mayan Number Converter - Public Phase

    is the game still on?

    LonkeroAdministrator
    (KiX Master Guru)
    2006-07-30 09:59 PM
    Re: KiXgolf: Mayan Number Converter - Public Phase

    here is one idea I was playing with but it backfired and came up with 172:
    Code:

    Function m($!)
    dim $,$b

    for $ = 1 to 19
    $b = split('- . : .: :: ' + $m)
    $m = $m + '| ' + $b[$]
    next

    for each $! in split($!)
    $m = $*$m + ascan($b,$!)
    if 0>$m
    $m = $b[$! mod $]
    $ = 1*$!/$
    if $
    $m = m($) + ' ' + $m
    EndFunction



    ShawnAdministrator
    (KiX Supporter)
    2006-07-31 12:28 AM
    Re: KiXgolf: Mayan Number Converter - Public Phase

    ja, and I was going down this path - same result:

    Code:

    if 19<$
    $m = m($b/20) + " " + $m



    LonkeroAdministrator
    (KiX Master Guru)
    2006-07-31 01:37 AM
    Re: KiXgolf: Mayan Number Converter - Public Phase

    not same result.
    with that you get 170.
    I also had a variation of 171. but that's the only one I found that doesn't increase the amount of strokes.
    but it doesn't lessen them either


    LonkeroAdministrator
    (KiX Master Guru)
    2006-07-31 01:41 AM
    Re: KiXgolf: Mayan Number Converter - Public Phase

    tbh, I've been working for hours for a way to get rid of the + ' ' +
    that adds extra five strokes for just a single space. stupid.

    but no luck there either.


    Sealeopard
    (KiX Master)
    2006-07-31 04:40 AM
    Re: KiXgolf: Mayan Number Converter - Public Phase

    The public round of the Mayan Number converted is closed now. I will post final scores tomorrow. Thansk to everybody for playing, it was a good crowd.

    Sealeopard
    (KiX Master)
    2006-08-01 05:27 AM
    Re: KiXgolf: Mayan Number Converter - Public Phase

    So, time for the final results. First, there's going to be a rule-change. If another party or two want to complain about anything KiXgolf-related, then this will need to beresolved in person by the involved parties in a nighborhoob bar in lovely Boston, MA, USA, planet Earth, Solar System, Milky Way (just incase soemobdy googles up another Boston ). No-shows loose automatically. Secondly, whoever looses the complaint will have to organize and script the next KiXgolf challenge without being able to compete in it.

    So, having said that, here are the results of the private and public round. please keep in mind that points are awared per person, not per submission, thus three submissions by a single person will only result in a single set of points.

    Participants (all receive one point): Jooel, Shawn, DrillSergeant, Maciep, Richard H, Allen, Howard Bullock, Glenn Barnas, It_took_my_meds, Jochen, Benny69, Krabourn

    Private round:
    Code:

    1. Jooel --------- 182 (6 points)
    1. Shawn --------- 213 (6 points)
    3. DrillSergeant - 217 (4 points)
    4. Maciep -------- 225 (3 points)
    5. Richard H ----- 252 (2 points)



    Public round:
    Code:

    1. Shawn --------- 167 (5 points)
    2. Jooel --------- 172 (4 points)
    3. DrillSargeant - 190 (3 points)
    4. Benny69 ------- 216 (2 points)
    5. Maciep -------- 225 (1 point)



    Leaderboard:
    Code:

    1. Shawn --------- 12 points
    2. Jooel --------- 11 points
    3. DrillSergeant - 8 points
    4. Maciep -------- 5 points
    5. Benny69 ------- 3 points
    5. Richard H ----- 3 points
    7. Allen --------- 1 point
    7. Glenn Barnas -- 1 point
    7. Howard Bullock 1 point
    7. It_took_my_meds 1 point
    7. Jochen -------- 1 point
    7. Krabourn ------ 1 point



    the next KiXgolf tournament is tentatively planned for the beginning of September and could be described as "jump'n'slide"


    JochenAdministrator
    (KiX Supporter)
    2006-08-01 08:55 AM
    Re: KiXgolf: Mayan Number Converter - Public Phase

    Yay!

    Thank you Jens for the organization of this round.
    Looking forward to the next one. Hopefully I have any time for the public round next time


    LonkeroAdministrator
    (KiX Master Guru)
    2006-08-01 09:35 AM
    Re: KiXgolf: Mayan Number Converter - Public Phase

    ey, wtf is 167 score for shawn?
    I only saw 170!

    that said, it was nice tournament.
    love you guys!


    DrillSergeant
    (MM club member)
    2006-08-01 10:08 AM
    Re: KiXgolf: Mayan Number Converter - Public Phase

    Thank you for a great tournament, Jens. Can't wait for the next one!

    Benny69
    (MM club member)
    2006-08-01 01:42 PM
    Re: KiXgolf: Mayan Number Converter - Public Phase

    Thanks Jens, You did a great job, the Mayan Number Converter was a fantastic idea and a lot of fun.