Page 3 of 3 <123
Topic Options
#69163 - 2002-08-20 04:09 PM Re: KiXtart Golf Tournament IV: Anagrams
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11162
Loc: Boston, MA, USA
Everybody:

Please test your Anagram scripts with KiXtart 4.11 RC-1. [Big Grin]

My script bombs with a line like this:
code:
$a=split($b,' ')[0]

It seems we lost the ability to directly reference an array element after a split operation. KiXtart 4.10a and KiXtart 4.11 beta 2 seem to work fine, though.

Anyway, now that your heart is racing, you are free to use any Kixtart version of your choosing.
_________________________
There are two types of vessels, submarines and targets.

Top
#69164 - 2002-08-20 04:09 PM Re: KiXtart Golf Tournament IV: Anagrams
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
What 4 tests? Jens only supplied one.

Still at:
KixGolf score = 458
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#69165 - 2002-08-20 04:24 PM Re: KiXtart Golf Tournament IV: Anagrams
kholm Offline
Korg Regular
*****

Registered: 2000-06-19
Posts: 714
Loc: Randers, Denmark
Jens,

Sad but true [Frown]

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 Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11162
Loc: Boston, MA, USA
Yeah, I'll report is as a bug [Wink]

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
#69167 - 2002-08-20 06:19 PM Re: KiXtart Golf Tournament IV: Anagrams
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22332
Loc: OK
after changing my udf to return empty strings instead of empty arrays the score raised:

Golf Score: 495

I'll give this up as my script has had so many structures all the loops one can think of and so much weirdness...
can't compete anymore.
_________________________
!

download KiXnet

Top
#69168 - 2002-08-20 07:19 PM Re: KiXtart Golf Tournament IV: Anagrams
Howard Bullock Offline
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 ]
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#69169 - 2002-08-20 07:42 PM Re: KiXtart Golf Tournament IV: Anagrams
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11162
Loc: Boston, MA, USA
Now that is strange, you should have passed the first and second test since they are just two different sets of anagrams.
_________________________
There are two types of vessels, submarines and targets.

Top
#69170 - 2002-08-20 07:45 PM Re: KiXtart Golf Tournament IV: Anagrams
Howard Bullock Offline
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 ]
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#69171 - 2002-08-20 08:43 PM Re: KiXtart Golf Tournament IV: Anagrams
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22332
Loc: OK
does that mean that I still have hope?

would like to hear AJH's current score too...
_________________________
!

download KiXnet

Top
#69172 - 2002-08-21 07:27 AM Re: KiXtart Golf Tournament IV: Anagrams
Howard Bullock Offline
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 [Big Grin]

{edit}
KixGolf score = 658

{edit}
KixGolf score = 653

{edit}
KixGolf score = 645

[ 21. August 2002, 18:00: Message edited by: Howard Bullock ]
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#69173 - 2002-08-21 08:28 AM Re: KiXtart Golf Tournament IV: Anagrams
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22332
Loc: OK
now, if ajh would just inform us where he is at.
otherwise I'll assume, I'm in lead again and rest this day.

anyway, if you get pass me, it's not that I didn't try, but I did best I could already at the weekend.
now, it's not compressable.
_________________________
!

download KiXnet

Top
#69174 - 2002-08-21 08:16 PM Re: KiXtart Golf Tournament IV: Anagrams
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
KixGolf score = 625
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#69175 - 2002-08-21 08:24 PM Re: KiXtart Golf Tournament IV: Anagrams
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22332
Loc: OK
you are running out of time [Big Grin]

sadly, didn't take my laptop home so can't post the to be winning code until tomorrow. means 10 hours from now.

[ 21. August 2002, 20:27: Message edited by: Lonkero ]
_________________________
!

download KiXnet

Top
#69176 - 2002-08-21 08:26 PM Re: KiXtart Golf Tournament IV: Anagrams
Anonymous
Unregistered


As stated previously
Current golf score = 487
Passes Jens 5 tests

Top
#69177 - 2002-08-21 08:28 PM Re: KiXtart Golf Tournament IV: Anagrams
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22332
Loc: OK
oh, man I like to see your script.

can't think of what method you used on it...
_________________________
!

download KiXnet

Top
Page 3 of 3 <123


Moderator:  Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 158 anonymous users online.
Newest Members
anhkfr, adamlevine, katherinknul, phamthuy, xuantu075
17631 Registered Users

Generated in 0.036 seconds in which 0.011 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