#191484 - 2008-12-30 12:35 AM
Re: KiXgolf: Instruens Fabulam - public round
[Re: Lonkero]
|
Lonkero
KiX Master Guru
Registered: 2001-06-05
Posts: 22346
Loc: OK
|
I don't like iif() that much. it has always been against golfers, just as it's now
Your solution passed all tests
KiXtart KiXtart Version = 4.53 KiXGolf Script = kixgolf_if.kix
Computer OS = Windows XP Professional CPU = Intel Pentium Model 15 Speed = 2131 MHz Memory = 1526 MB
KiXGolf Scoring Engine Scoring Engine = 3.3
KiXtart Golf Score Tournament = Instruens Fabulam Processing Start = 2008/12/30 01:34:31.218 Processing End = 2008/12/30 01:34:31.234 Duration = 0000/00/00 00:00:00.016 KiXGolf Score = 547
; begin KiXgolfUDF
;
;!
function cif($a,$p)
dim $r,$c,$i,$,$d,$z
$z=@crlf
$p=split($p,$z)
$r=ubound($p)
$c=($a^)-1
dim $y[$r,$c] , $l[$c], $t[$c]
for $i=0 to $r
for $=0 to $c
$d=split($p[$i],"&")[$]
$y[$i,$]=$d
if ($d^) > $l[$]
$l[$]=0^$d
endif
next
next
for $i=0 to $r
for $=0 to $c
$p=substr($a,$+1,1)
while ($y[$i,$]^)<$l[$]
$d=" " + $y[$i,$] + " "
$y[$i,$]=iif( $p=">",left($d,~),right( $d,iif( $p="=",$l[$],~ ) ) )
loop
while ($t[$]^)< $l[$]+2
$t[$]=$t[$]+"-"
loop
next
next
$p="@" + join($t,"-") + "@"
$d=$p+$z
for $i=0 to $r
for $=0 to $c
$d=$d+iif($i=1 & $=0,"|" + join($t,"+") + "|" + $z,"") + "| " + $y[$i,$]+ " "
next
$d=$d+ "|" + $z
$cif=$d + $p
endfunction
;!
;!
; end KiXgolfUDF
_________________________
!download KiXnet
|
Top
|
|
|
|
#191489 - 2008-12-30 10:04 AM
Re: KiXgolf: Instruens Fabulam - public round
[Re: Lonkero]
|
Richard H.
Administrator
Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
|
richie boy... no matter what postprepper you are using, please drop it. ppl can't copy&paste your code to their favorite editor without losing format.
Ok, here in plain text.
; begin KiXgolfUDF
;
;!
Function CIF($a, $y)
Dim $,$s,$l,$e,$h,$z,$c
$l=($a^)-1
Dim $w[$l]
$c=@CRLF
$y=Split($y,$c)
;
; LOOP 1 - pass through data and record longest entry in each column
; We also construct table top/botton/heading template as we go
;
For Each $s in $y
$h=@
For $=0 to $l
$e=0^Split($s,"&")[$]
If $w[$]<$e $w[$]=$e EndIf
$h=Trim($h+" "+j($w[$],"<",@,"-"))
Next
Next
;
; LOOP 2 - Pass through data again, constructing table body
;
For Each $s in $y
$e=@
For $=0 to $l
$e=$e+" | "+j($w[$],SubStr($a,$+1,1),Split($s,"&")[$]," ") ; Format data line
Next
$z=$z+"|"+SubStr($e,3)+" |"+$c
+IIf($z=@,"|-"+Join(Split($h),"-+-")+"-|"+$c,@) ; IIf() the table is empty then this is the header line
Next
; Add the header line to the top and bottom of the table
$h="@-"+Join(Split($h),"---")+"-@"
$CIF=$h+$c+$z+$h
EndFunction
; Justification UDF
; $w=Width
; $t=Justification type
; $s=String to justify
; $c=Fill character
;
Function j($w,$t,$s,$c)
Dim $,$x
If $t="=" $=$c EndIf ; Centre Justify, start on right
while ($s^)<$w
$s=Left($c,$t=">")+$j+$s+Left($c,$t="<")+$
$x=$ $=$j $j=$x ; Toggle centre justify RHS <-> LHS
Loop
$j=$s
EndFunction
;!
;!
; end KiXgolfUDF
; vim:filetype=kix sw=4 ts=4
|
Top
|
|
|
|
#191494 - 2008-12-30 12:00 PM
Re: KiXgolf: Instruens Fabulam - public round
[Re: Lonkero]
|
Lonkero
KiX Master Guru
Registered: 2001-06-05
Posts: 22346
Loc: OK
|
so, thanks. here is 613 on benny's:
Function CIF($f, $)
Dim $b,$d,$e[($f^)],$g,$h,$j,$k,$l,$o,$p,$s,$t,$u,$!
$! = @CRLF
$ = Split($, $!)
$g = ($f ^) - 1
For Each $b in $
$b = Split($b, '&')
For $d = 0 to $g
if $e[$d] < ($b[$d]^)
$e[$d] = $b[$d]^0
endif
Next
Next
For $d = 0 to $g
$o = $o + $e[$d]
Next
$s = 1
For Each $b in $
For $d = 0 to $g
$ = Split($b, '&')
$h = SubStr($f,$d+1,1)
$u = $[$d]
For $j = 1 to $e[$d] +2
$p = $p + '-'
Next
$j = $e[$d] - ($u^)
If $s
$p = $p + '+'
EndIf
For $k = 1 to $j /2
$l = $l + ' '
Next
$ = IIf($j mod 2,' ',@)
$t = Join(Split($t+'| '+IIf($h<>'=',IIf($h='<',$u+$l+$l+$,$l+$l+$+$u),$l+$u+$l+$)+' |','||'),'|')
$l = @
Next
$t = $t + $! + IIf($s,'|' + Left($p, ~) + '|' + $!,@)
$s = 0
Next
For $k = 1 to $o+3*($f^)-1
$l = $l + '-'
; Next
$CIF = '@' + $l + '@' + $! + $t + '@' + $l + '@'
EndFunction
_________________________
!download KiXnet
|
Top
|
|
|
|
#191495 - 2008-12-30 12:03 PM
Re: KiXgolf: Instruens Fabulam - public round
[Re: Lonkero]
|
Lonkero
KiX Master Guru
Registered: 2001-06-05
Posts: 22346
Loc: OK
|
546 is the new leader.
; begin KiXgolfUDF
;
;!
function cif($a,$p)
dim $r,$c,$i,$,$d,$z
$z=@crlf
$p=split($p,$z)
$r=ubound($p)
$c=($a^)-1
dim $y[$r,$c] , $l[$c], $t[$c]
for $i=0 to $r
for $=0 to $c
$d=split($p[$i],"&")[$]
$y[$i,$]=$d
if ($d^) > $l[$]
$l[$]=0^$d
endif
next
next
for $i=0 to $r
for $=0 to $c
$p=substr($a,$+1,1)
while ($y[$i,$]^)<$l[$]
$d=" " + $y[$i,$] + " "
$y[$i,$]=iif( $p=">",left($d,~),right( $d,iif( $p="=",$l[$],~ ) ) )
loop
while ($t[$]^)< $l[$]+2
$t[$]=$t[$]+"-"
loop
next
next
$p="@" + join($t,"-") + "@"
$d=$p+$z
for $i=0 to $r
for $=0 to $c
$d=$d+iif($i=1 & $=0,"|" + join($t,"+") + "|" + $z,@) + "| " + $y[$i,$]+ " "
next
$d=$d+ "|" + $z
$cif=$d + $p
endfunction
;!
;!
; end KiXgolfUDF
_________________________
!download KiXnet
|
Top
|
|
|
|
#191501 - 2008-12-30 07:15 PM
Re: KiXgolf: Instruens Fabulam - public round
[Re: Lonkero]
|
DrillSergeant
MM club member
Registered: 2004-07-09
Posts: 1164
Loc: Eijsden, the Netherlands
|
New leader:
Your solution passed all tests
KiXtart
KiXtart Version = 4.60
KiXGolf Script = kixgolf_if.KIX
Computer
OS = Windows Vista Business Edition
CPU = Intel Pentium Model 15
Speed = 2194 MHz
Memory = 2038 MB
KiXGolf Scoring Engine
Scoring Engine = 3.3
KiXtart Golf Score
Tournament = Instruens Fabulam
Processing Start = 2008/12/30 19:12:33.475
Processing End = 2008/12/30 19:12:33.553
Duration = 0000/00/00 00:00:00.077
KiXGolf Score = 435
Thank you for participating in KiXtart Golf!
; begin KiXgolfUDF
;
;!
Function CIF($d, $l)
Dim $, $c, $i, $j, $p, $k, $o, $r, $t[($d^)-1], $z
$z = @crlf
$l = split($l,$z)
For $k = 0 to 1
$c='@' + join($t,'-') + '@'
$r = $c + $z
For $i = 0 to ubound($l)
For $j = 0 to ($d^)-1
$ = split($l[$i],'&')[$j]
$o = substr($d,$j+1,1)
$p = $t[$j]
while ($p^)<($^)+2
$p = $p + '-'
Loop
while ($p^)>($^)+2
$ = ' ' + $ + ' '
$ = iif( $o=">",left($,~),right( $,iif( $o="=",($p^)-2,~ ) ) )
Loop
$t[$j] = $p
$r = $r + '| ' + $ + ' '
Next
$r = $r + '|'+$z
if $i = 0
$r = $r + '|' + join($t,'+') + '|' + $z
endif
Next
Next
$cif = $r + $c
EndFunction
;!
;!
; end KiXgolfUDF
_________________________
The Code is out there
|
Top
|
|
|
|
#191502 - 2008-12-30 07:18 PM
Re: KiXgolf: Instruens Fabulam - public round
[Re: DrillSergeant]
|
DrillSergeant
MM club member
Registered: 2004-07-09
Posts: 1164
Loc: Eijsden, the Netherlands
|
and 431:
; begin KiXgolfUDF
;
;!
Function CIF($d, $l)
Dim $, $c, $i, $j, $p, $k, $o, $r, $t[($d^)-1], $z
$z = @crlf
$l = split($l,$z)
For $k = 0 to 1
$c='@' + join($t,'-') + '@'
$r = $c + $z
For $i = 0 to ubound($l)
For $j = 0 to ($d^)-1
$ = split($l[$i],'&')[$j]
$o = substr($d,$j+1,1)
$p = $t[$j]
while ($p^)<($^)+2
$p = $p + '-'
Loop
while ($p^)>($^)+2
$ = ' ' + $ + ' '
$ = iif( $o=">",left($,~),right( $,iif( $o="=",($p^)-2,~ ) ) )
Loop
$t[$j] = $p
$r = $r + '| ' + $ + ' '
Next
$r = $r + '|'+$z
if $i = 0
$r = $r + '|' + join($t,'+') + '|' + $z
endif
Next
$cif = $r + $c
EndFunction
;!
;!
; end KiXgolfUDF
_________________________
The Code is out there
|
Top
|
|
|
|
#191503 - 2008-12-30 07:20 PM
Re: KiXgolf: Instruens Fabulam - public round
[Re: DrillSergeant]
|
DrillSergeant
MM club member
Registered: 2004-07-09
Posts: 1164
Loc: Eijsden, the Netherlands
|
and 427:
; begin KiXgolfUDF
;
;!
Function CIF($d, $l)
Dim $, $c, $i, $j, $p, $k, $o, $r, $t[($d^)-1], $z
$z = @crlf
$l = split($l,$z)
For $k = 0 to 1
$c='@' + join($t,'-') + '@'
$r = $c + $z
For $i = 0 to ubound($l)
For $j = 0 to ($d^)-1
$ = split($l[$i],'&')[$j]
$o = substr($d,$j+1,1)
$p = $t[$j]
while ($p^)<($^)+2
$p = $p + '-'
Loop
while ($p^)>($^)+2
$ = ' ' + $ + ' '
$ = iif( $o=">",left($,~),right( $,iif( $o="=",($p^)-2,~ ) ) )
Loop
$t[$j] = $p
$r = $r + '| ' + $ + ' '
Next
$r = $r + '|'+$z
if $i = 0
$r = $r + '|' + join($t,'+') + '|' + $z
endif
$cif = $r + $c
EndFunction
;!
;!
; end KiXgolfUDF
_________________________
The Code is out there
|
Top
|
|
|
|
#191504 - 2008-12-30 07:36 PM
Re: KiXgolf: Instruens Fabulam - public round
[Re: DrillSergeant]
|
DrillSergeant
MM club member
Registered: 2004-07-09
Posts: 1164
Loc: Eijsden, the Netherlands
|
and 423:
; begin KiXgolfUDF
;
;!
Function CIF($d, $l)
Dim $, $c, $i, $j, $p, $k, $o, $r, $t[($d^)-1], $z
$z = @crlf
$l = split($l,$z)
For $k = 0 to 1
$c='@' + join($t,'-') + '@'
$r = $c + $z
For $i = 0 to ubound($l)
For $j = 0 to ($d^)-1
$ = split($l[$i],'&')[$j]
$o = substr($d,$j+1,1)
$p = $t[$j]
while ($p^)<($^)+2
$p = $p + '-'
Loop
while ($p^)>($^)+2
$ = ' ' + $ + ' '
$ = iif( $o=">",left($,~),right( $,iif( $o="=",($p^)-2,~ ) ) )
Loop
$t[$j] = $p
$r = $r + '| ' + $ + ' '
Next
$r = $r + '|'+$z + iif($i=0, '|' + join($t,'+') + '|' + $z,@)
$cif = $r + $c
EndFunction
;!
;!
; end KiXgolfUDF
_________________________
The Code is out there
|
Top
|
|
|
|
#191506 - 2008-12-30 08:23 PM
Re: KiXgolf: Instruens Fabulam - public round
[Re: DrillSergeant]
|
Lonkero
KiX Master Guru
Registered: 2001-06-05
Posts: 22346
Loc: OK
|
hihii.
Your solution passed all tests
KiXtart KiXtart Version = 4.53 KiXGolf Script = kixgolf_if.kix
Computer OS = Windows XP Professional CPU = Intel Pentium Model 15 Speed = 2131 MHz Memory = 1526 MB
KiXGolf Scoring Engine Scoring Engine = 3.3
KiXtart Golf Score Tournament = Instruens Fabulam Processing Start = 2008/12/30 21:21:41.890 Processing End = 2008/12/30 21:21:41.906 Duration = 0000/00/00 00:00:00.016 KiXGolf Score = 422
Function CIF($d, $l)
Dim $, $c, $i, $j, $p, $k, $o, $r, $t[($d^)-1]
$ = @crlf
$l = split($l,$)
For $k = 0 to 1
$c='@' + join($t,'-') + '@'
$r = $c + $
For $i = 0 to ubound($l)
For $j = 0 to ($d^)-1
$ = split($l[$i],'&')[$j]
$o = substr($d,$j+1,1)
$p = $t[$j]
while ($p^)<($^)+2
$p = $p + '-'
Loop
while ($p^)>($^)+2
$ = ' ' + $ + ' '
$ = iif( $o=">",left($,~),right( $,iif( $o="=",($p^)-2,~ ) ) )
Loop
$t[$j] = $p
$r = $r + '| ' + $ + ' '
Next
$ = @crlf
$r = $r + '|'+$ + iif($i=0, '|' + join($t,'+') + '|' + $,@)
$cif = $r + $c
EndFunction
_________________________
!download KiXnet
|
Top
|
|
|
|
#191508 - 2008-12-30 08:49 PM
Re: KiXgolf: Instruens Fabulam - public round
[Re: Lonkero]
|
Lonkero
KiX Master Guru
Registered: 2001-06-05
Posts: 22346
Loc: OK
|
LOL! 420...
Your solution passed all tests
KiXtart KiXtart Version = 4.53 KiXGolf Script = kixgolf_if.kix
Computer OS = Windows XP Professional CPU = Intel Pentium Model 15 Speed = 2131 MHz Memory = 1526 MB
KiXGolf Scoring Engine Scoring Engine = 3.3
KiXtart Golf Score Tournament = Instruens Fabulam Processing Start = 2008/12/30 21:48:37.359 Processing End = 2008/12/30 21:48:37.375 Duration = 0000/00/00 00:00:00.016 KiXGolf Score = 420
Function CIF($d, $l)
Dim $, $c, $i, $j, $p, $k, $o, $r, $t[($d^)-1]
$ = @crlf
$l = split($l,$)
For $k = 0 to 1
$c='@' + join($t,'-') + '@'
$r = $c + $
For $i = 0 to ubound($l)
For $j = 0 to ($d^)-1
$ = split($l[$i],'&')[$j]
$p = $t[$j]
while ($p^)<($^)+2
$p = $p + '-'
Loop
while ($p^)>($^)+2
$ = ' ' + $ + ' '
$o = substr($d,$j+1,1)
$ = iif( $o=">",left($,~),right( $,iif( $o="=",($p^)-2,~ ) ) )
Loop
$t[$j] = $p
$r = $r + '| ' + $ + ' '
Next
$ = @crlf
$r = $r + '|'+$ + iif($i,@,'|' + join($t,'+') + '|' + $)
$cif = $r + $c
EndFunction
_________________________
!download KiXnet
|
Top
|
|
|
|
#191509 - 2008-12-30 09:00 PM
Re: KiXgolf: Instruens Fabulam - public round
[Re: Lonkero]
|
Lonkero
KiX Master Guru
Registered: 2001-06-05
Posts: 22346
Loc: OK
|
407
Function CIF($d, $l)
Dim $, $c, $i, $j, $p, $k, $o, $r, $t[($d^)-1],$x
$ = @crlf
For $k = 0 to 1
$c='@' + join($t,'-') + '@'
$r = $c + $
$x = '|' + join($t,'+') + '|' + $
For each $i in split($l,$)
For $j = 0 to ($d^)-1
$ = split($i,'&')[$j]
$p = $t[$j]
while ($p^)<($^)+2
$p = $p + '-'
Loop
while ($p^)>($^)+2
$ = ' ' + $ + ' '
$o = substr($d,$j+1,1)
$ = iif( $o=">",left($,~),right( $,iif( $o="=",($p^)-2,~ ) ) )
Loop
$t[$j] = $p
$r = $r + '| ' + $ + ' '
Next
$ = @crlf
$r = $r + '|'+$ + $x
$x = @
$cif = $r + $c
EndFunction
_________________________
!download KiXnet
|
Top
|
|
|
|
#191510 - 2008-12-30 09:26 PM
Re: KiXgolf: Instruens Fabulam - public round
[Re: Lonkero]
|
Lonkero
KiX Master Guru
Registered: 2001-06-05
Posts: 22346
Loc: OK
|
again, losing iif gives a score... 406
Function CIF($d, $l)
Dim $, $c, $i, $j, $p, $k, $o, $r, $t[($d^)-1],$x
$ = @crlf
For $k = 0 to 1
$c='@' + join($t,'-') + '@'
$r = $c + $
$x = '|' + join($t,'+') + '|' + $
For each $i in split($l,$)
For $j = 0 to ($d^)-1
$ = split($i,'&')[$j]
$p = $t[$j]
while ($p^)<($^)+2
$p = $p + '-'
Loop
while ($p^)>($^)+2
$ = ' ' + $ + ' '
$o = substr($d,$j+1,1)
$ = iif( $o=">",left($,~),right( $,(($p^)-1)*($o="=")-1) )
Loop
$t[$j] = $p
$r = $r + '| ' + $ + ' '
Next
$ = @crlf
$r = $r + '|'+$ + $x
$x = @
$cif = $r + $c
EndFunction
_________________________
!download KiXnet
|
Top
|
|
|
|
Moderator: Arend_, Allen, Jochen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Mart
|
0 registered
and 366 anonymous users online.
|
|
|