code:
; This function scores the specified file and returns the KixGolf score.
; That is the total number of key strokes used to build a script not counting
; comments, spaces, tabs, or any ascii character above 126.
Function KixGolf($A)
if open (1,$A) = 0
$X=0
$Q=""
$C=readLine(1)
while @error=0
$j=len($C) ; Get length of the line
for $h=1 to $j ; Loop through each character in line
$D=asc(substr($C,$h,1))
if $D=34 or $D=39
if $Q=""
$Q=$D
else
if $Q=$D
$Q=""
endif
endif
endif

if $D=59 ; Ignore comment lines
$h=$j ; Terminate loop
else
if $Q<>""
$X=$X+1 ; Count the valid characters
else
if $D>32 and $D<127
$X=$X+1 ; Count the valid characters
endif
endif
endif
next
$C=readLine(1)
loop
else
? "$A ??" ; Show bad file name
endif
if $Q<>""
? "Mis-matched quotes. Probable score error." ?
endif
$KixGolf=$X
EndFunction

? "KixGolf score = " + KixGolf($A) ;$A must be initialized on the command line.
;%tmp%\kix32 kixgolf.kix $A=Kixgolf.kix



[ 04 June 2002, 19:46: Message edited by: Howard Bullock ]
_________________________
Home page: http://www.kixhelp.com/hb/