#69164 - 2002-08-20 04:09 PM
Re: KiXtart Golf Tournament IV: Anagrams
|
Howard Bullock
KiX Supporter
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
What 4 tests? Jens only supplied one.
Still at: KixGolf score = 458
|
Top
|
|
|
|
#69165 - 2002-08-20 04:24 PM
Re: KiXtart Golf Tournament IV: Anagrams
|
kholm
Korg Regular
Registered: 2000-06-19
Posts: 714
Loc: Randers, Denmark
|
Jens,
Sad but true
It seems that you are right, you can't directly reference a member from the split() function when using v. 4.11 rc1
-Erik
|
Top
|
|
|
|
#69166 - 2002-08-20 04:49 PM
Re: KiXtart Golf Tournament IV: Anagrams
|
Sealeopard
KiX Master
Registered: 2001-04-25
Posts: 11164
Loc: Boston, MA, USA
|
Yeah, I'll report is as a bug
Also, I ahve expanded my test suite again, this time with more anagrams. The latest version of th test suite is posted below and (because of the extremely long lines) can also be downloaded at http://people.bu.edu/jenmeyer/kixtart/anagram_test.zip
You will also need the KiXGolf3.kix file and KiXtart in the same directory as the test script. then just paste your Anagram UDF into it, and it'll validate your UDF and spit out the KiXtart golf score.
I'm done with my script, passing all five validation test and achieving a test score of 742 and no way of shortening it.
code:
BREAK ON
DIM $rc, $inputarray, $correctoutput, $outputarray, $line DIM $error1, $error2, $error3, $error4, $error5, $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] 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 another regular array $inputarray='admirer,parental,whatever,trifles,repost,kixtart,raddle,lifters,tartkiz,atrophied,filters,warez,perseus,paternal,married,with,children,larded,hoes,poster,hose,filets,prenatal,parlante,itself,stifler,aphrodite,stifle,portes,shoe,ladder,peruses,presto' $correctoutput='admirer married,aphrodite atrophied,perseus peruses,filets itself stifle,hoes hose shoe,ladder larded raddle,filters lifters stifler trifles,parental parlante paternal prenatal,portes poster presto repost'
$inputarray=SPLIT($inputarray,',') $correctoutput=SPLIT($correctoutput,',')
$outputarray=Anagram($inputarray)
IF UBOUND($outputarray)=UBOUND($correctoutput) FOR $line=0 TO UBOUND($outputarray) ? $outputarray[$line] IF $outputarray[$line]<>$correctoutput[$line] ? 'The output array element '+$outputarray[$line]+' is incorrect' $error2=1 ENDIF NEXT ELSE ? 'The output array has an incorret size of '+UBOUND($outputarray) $error2=1 ENDIF if $error2 color r+/n ? 'UDF failed another regular input array test' color w/n else ? 'UDF passed another regular input array test' endif ; end testing with another regular array
; begin testing with empty array redim $inputarray[0] $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 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' $error4=1 ENDIF if $error4 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' $error5=1 ENDIF NEXT ELSE ? 'The output array has an incorret size of '+UBOUND($outputarray) $error5=1 ENDIF if $error5 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 or $error5 color r+/n ? 'The Anagram() UDF failed validation' color w/n ELSE ? 'The Anagram() UDF passed validation' ENDIF
$shellcommand=@scriptdir+'\kix32.exe '+@scriptdir+'\Kixgolf3.kix $f='+@scriptname ? $shellcommand shell $shellcommand
; end of the kiXtart Golf validation script
; beginning of the Anagram() UDF and supporting UDFs ;!
;! ;! ; end of the Anagram() UDF and supporting UDFs
_________________________
There are two types of vessels, submarines and targets.
|
Top
|
|
|
|
#69168 - 2002-08-20 07:19 PM
Re: KiXtart Golf Tournament IV: Anagrams
|
Howard Bullock
KiX Supporter
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
My score will probably being going up as well. I just ran Jens new validation code and only passed the first test. [ 20. August 2002, 20:49: Message edited by: Howard Bullock ]
|
Top
|
|
|
|
#69170 - 2002-08-20 07:45 PM
Re: KiXtart Golf Tournament IV: Anagrams
|
Howard Bullock
KiX Supporter
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
I cheated on the half of the sorting since I was coding to the inital test only. My sorting algorithm succeeded in one step with the first array but could and did fail on a different mix of words. [ 20. August 2002, 19:47: Message edited by: Howard Bullock ]
|
Top
|
|
|
|
#69172 - 2002-08-21 07:27 AM
Re: KiXtart Golf Tournament IV: Anagrams
|
Howard Bullock
KiX Supporter
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
Started from scratch again.
C:\Data\Scripts\Golf>C:\Data\Kix2001\KiX2001.411b2\kix32 golf4.kix
feeling fleeing snooped spooned last salt slat ablest bleats stable tables UDF passed regular input array test admirer married aphrodite atrophied perseus peruses filets itself stifle hoes hose shoe ladder larded raddle filters lifters stifler trifles parental parlante paternal prenatal portes poster presto repost UDF passed another regular input array test UDF passed empty input array test UDF passed empty input string test UDF passed no anagram input array test The Anagram() UDF passed validation
KixGolf score = 672
time to start tweaking
{edit} KixGolf score = 658
{edit} KixGolf score = 653
{edit} KixGolf score = 645 [ 21. August 2002, 18:00: Message edited by: Howard Bullock ]
|
Top
|
|
|
|
#69174 - 2002-08-21 08:16 PM
Re: KiXtart Golf Tournament IV: Anagrams
|
Howard Bullock
KiX Supporter
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
|
Top
|
|
|
|
#69176 - 2002-08-21 08:26 PM
Re: KiXtart Golf Tournament IV: Anagrams
|
Anonymous
Anonymous
Unregistered
|
As stated previously Current golf score = 487 Passes Jens 5 tests
|
Top
|
|
|
|
Moderator: Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart
|
0 registered
and 248 anonymous users online.
|
|
|