AJH:

I don't think you read it correctly, I specified that the OUTPUT STRING is empty, thus VARTYPE=8.

Anyway, below is a more extensive validation script. It checks four different conditions
1) Anagrams (as provided in the firts post)
2) Empty input string
3) Empty input array
4) Input string with words but not containing any anagrams

My score is now 742 passing all four conditions and I have absolutely no clue how to cut out about 1/3rd of my code to come close to you guys [Wink]

code:
BREAK ON

DIM $rc, $inputarray, $correctoutput, $outputarray, $line
DIM $error1, $error2, $error3, $error4, $shellcommand

$rc=SETOPTION('Explicit','ON')
$rc=SETOPTION('NoVarsInString','ON')


; begin testing with regular array
$inputarray='hack,snooped,tables,salt,spiff,feeling,spooned,last,grep,bleats,gas,ablest,fleeing,stable,slat,drive'
$correctoutput='feeling fleeing,snooped spooned,last salt slat,ablest bleats stable tables'

$inputarray=SPLIT($inputarray,',')
$correctoutput=SPLIT($correctoutput,',')

$outputarray=Anagram($inputarray)

IF UBOUND($outputarray)=UBOUND($correctoutput)
FOR $line=0 TO UBOUND($outputarray)
? $outputarray[$line]+' = '+$correctoutput[$line]
IF $outputarray[$line]<>$correctoutput[$line]
? 'The output array element '+$outputarray[$line]+' is incorrect'
$error1=1
ENDIF
NEXT
ELSE
? 'The output array has an incorret size of '+UBOUND($outputarray)
$error1=1
ENDIF
if $error1
color r+/n
? 'UDF failed regular input array test'
color w/n
else
? 'UDF passed regular input array test'
endif
; end testing with regular array


; begin testing with empty array
redim $inputarray[10]
$correctoutput=''

$outputarray=Anagram($inputarray)

if $outputarray<>$correctoutput
? 'The output array is not empty'
$error2=1
ENDIF
if $error2
color r+/n
? 'UDF failed empty input array test'
color w/n
else
? 'UDF passed empty input array test'
endif
; end testing with empty array


; begin testing with empty string
$inputarray=''
$correctoutput=''

$outputarray=Anagram($inputarray)

IF $outputarray<>$correctoutput
? 'The output array is not empty'
$error3=1
ENDIF
if $error3
color r+/n
? 'UDF failed empty input string test'
color w/n
else
? 'UDF passed empty input string test'
endif
; end testing with empty string

; begin testing with array of no anagrams
$inputarray='test,testing,tester,store'
$inputarray=SPLIT($inputarray,',')
$correctoutput=''

$outputarray=Anagram($inputarray)

IF UBOUND($outputarray)=UBOUND($correctoutput)
FOR $line=0 TO UBOUND($outputarray)
? $outputarray[$line]+' = '+$correctoutput[$line]
IF $outputarray[$line]<>$correctoutput[$line]
? 'The output array element '+$outputarray[$line]+' is incorrect'
$error4=1
ENDIF
NEXT
ELSE
? 'The output array has an incorret size of '+UBOUND($outputarray)
$error4=1
ENDIF
if $error4
color r+/n
? 'UDF failed no anagram input array test'
color w/n
else
? 'UDF passed no anagram input array test'
endif
; end testing with array of no anagrams


IF $error1 or $error2 or $error3 or $error4
color r+/n
? 'The Anagram() UDF failed validation'
color w/n
ELSE
? 'The Anagram() UDF passed validation'
ENDIF

; if KiXGolf3.kix (the latest version of the kiXtart golf scoring script is in the same
; diretory as the KiXtart Golf script and the KiXtart executable then it'll display the
; official KiXtart golf score
$shellcommand=@scriptdir+'\kix32.exe '+@scriptdir+'\Kixgolf3.kix $f='+@scriptname
? $shellcommand
shell $shellcommand

; end of the kiXtart Golf validation script

_________________________
There are two types of vessels, submarines and targets.