New KixGolf for Shawn.
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.
;
; The script will start counting on "odd" (1,3,5,...) occurrances
; of ";!" and the script will not count after "even" (0,2,4,...)
; instances of ";!".
;
;Syntax: %tmp%\kix32 kixgolf.kix $A=Kixgolf.kix
;

Function KixGolf($A)
if open (1,$A) = 0
$X=0
$Q=""
$C=readLine(1)
while @error=0
if instr($C, ";!")>0
$countem = $countem + 1 & 1
endif
If $countem
$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
endif
$C=readLine(1)
loop
else
? "$A ??" ; Show bad file name
endif
if $Q<>""
? "Mis-matched quotes. Probable score error." ?
endif
$KixGolf=$X
EndFunction

;$A must be initialized on the command line.
;%tmp%\kix32 kixgolf.kix $A=Kixgolf.kix

? "KixGolf score = " + KixGolf($A)



[ 11 June 2002, 06:32: Message edited by: Howard Bullock ]
_________________________
Home page: http://www.kixhelp.com/hb/