Page 2 of 4 <1234>
Topic Options
#191484 - 2008-12-30 12:35 AM Re: KiXgolf: Instruens Fabulam - public round [Re: Lonkero]
Lonkero Administrator Offline
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 \:\)
 Quote:

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

 Code:
; 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 Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
 Originally Posted By: Lonkero
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.
 Code:
; 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
#191490 - 2008-12-30 10:11 AM Re: KiXgolf: Instruens Fabulam - public round [Re: Richard H.]
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
why that @ without quotes works for you?

I just wonder... tried on some other code and it stopped working.
_________________________
!

download KiXnet

Top
#191491 - 2008-12-30 10:24 AM Re: KiXgolf: Instruens Fabulam - public round [Re: Lonkero]
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
 Originally Posted By: Lonkero
why that @ without quotes works for you?

I just wonder... tried on some other code and it stopped working.


Dunno - I tried both 4.60 and 4.53 and it works.

Maybe it's a language thing.

Top
#191492 - 2008-12-30 10:25 AM Re: KiXgolf: Instruens Fabulam - public round [Re: Richard H.]
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
I'm using the @ to reset a variable to null, not to set it to "@".
Top
#191493 - 2008-12-30 11:56 AM Re: KiXgolf: Instruens Fabulam - public round [Re: Richard H.]
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
ah.
_________________________
!

download KiXnet

Top
#191494 - 2008-12-30 12:00 PM Re: KiXgolf: Instruens Fabulam - public round [Re: Lonkero]
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
so, thanks.
here is 613 on benny's:

 Code:
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 Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
546 is the new leader.

 Code:
; 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
#191497 - 2008-12-30 02:48 PM Re: KiXgolf: Instruens Fabulam - public round [Re: Lonkero]
Allen Administrator Online   shocked
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4549
Loc: USA
I can't see what you changed... would you mind pointing it out?
Top
#191499 - 2008-12-30 03:52 PM Re: KiXgolf: Instruens Fabulam - public round [Re: Allen]
DrillSergeant Offline
MM club member
*****

Registered: 2004-07-09
Posts: 1164
Loc: Eijsden, the Netherlands
He changed "" to @ in this line:

$d=$d+iif($i=1 & $=0,"|" + join($t,"+") + "|" + $z,@) + "| " + $y[$i,$]+ " "

A variation to Richard's find:
 Quote:

I'm using the @ to reset a variable to null, not to set it to "@".
_________________________
The Code is out there

Top
#191500 - 2008-12-30 04:05 PM Re: KiXgolf: Instruens Fabulam - public round [Re: DrillSergeant]
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
indeed.
_________________________
!

download KiXnet

Top
#191501 - 2008-12-30 07:15 PM Re: KiXgolf: Instruens Fabulam - public round [Re: Lonkero]
DrillSergeant Offline
MM club member
*****

Registered: 2004-07-09
Posts: 1164
Loc: Eijsden, the Netherlands
New leader:

 Code:
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!


 Code:
; 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 Offline
MM club member
*****

Registered: 2004-07-09
Posts: 1164
Loc: Eijsden, the Netherlands
and 431:

 Code:
; 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 Offline
MM club member
*****

Registered: 2004-07-09
Posts: 1164
Loc: Eijsden, the Netherlands
and 427:
 Code:
; 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 Offline
MM club member
*****

Registered: 2004-07-09
Posts: 1164
Loc: Eijsden, the Netherlands
and 423:
 Code:
; 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 Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
hihii.
 Quote:

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


 Code:
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 Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
LOL! 420...
 Quote:

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

 Code:
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 Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
407
 Code:
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 Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
again, losing iif gives a score...
406
 Code:
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
#191511 - 2008-12-30 09:33 PM Re: KiXgolf: Instruens Fabulam - public round [Re: Lonkero]
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
guys, why are you only lurking?
lets keep the chatter going.
I wanna know if you are working on something...
_________________________
!

download KiXnet

Top
Page 2 of 4 <1234>


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

Who's Online
0 registered and 628 anonymous users online.
Newest Members
Raoul, Timothy, Jojo67, MaikSimon, kvn317
17875 Registered Users

Generated in 0.198 seconds in which 0.156 seconds were spent on a total of 13 queries. Zlib compression enabled.

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