Page 2 of 3 <123>
Topic Options
#69143 - 2002-08-18 08:45 PM Re: KiXtart Golf Tournament IV: Anagrams
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
Golf Score: 483

{edit 21:23}
Golf Score: 482

[ 18. August 2002, 21:23: Message edited by: Lonkero ]
_________________________
!

download KiXnet

Top
#69144 - 2002-08-18 09:49 PM Re: KiXtart Golf Tournament IV: Anagrams
MightyR1 Offline
MM club member
*****

Registered: 1999-09-09
Posts: 1264
Loc: The Netherlands
Jens,

what if the number of words in a set exceeds 15?

discard the rest or make a set of 15 and a set of the rest? How must this be printed?
_________________________
Greetz,
Patrick Rutten

- We'll either find a way or make one...
- Knowledge is power; knowing how to find it is more powerful...
- Problems don't exist; they are challenges...

Top
#69145 - 2002-08-18 09:56 PM Re: KiXtart Golf Tournament IV: Anagrams
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
well, I understood that it will not exceed.
means no checking for that is needed.
also, it may and may not work for with longer ones too.
I tested my shortest code with:
$inputarray='hack,snooped,tables,salt,spiff,tnipr,feeling,spooned,last,print,intpr,grep,bleats,gas,ablest,fleeing,stable,slat,drive,rpitn'


and output was:

feeling fleeing
snooped spooned
last salt slat
ablest bleats stable tables
intpr print rpitn tnipr


[ 18. August 2002, 21:57: Message edited by: Lonkero ]
_________________________
!

download KiXnet

Top
#69146 - 2002-08-18 10:37 PM Re: KiXtart Golf Tournament IV: Anagrams
Anonymous
Unregistered


Golf Score 507
Can't seem to break the magic 500 barrier

Top
#69147 - 2002-08-18 11:06 PM Re: KiXtart Golf Tournament IV: Anagrams
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
I have some difficulties here too.

I tried changing and compining and mixing.
got it to work but scores went to 490...

can't seem to cut this anymore.
_________________________
!

download KiXnet

Top
#69148 - 2002-08-19 01:03 AM Re: KiXtart Golf Tournament IV: Anagrams
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
now it's done. after three hours of playing with simple if statement saves one stroke getting me to
Golf Score: 481

{edit [02:20 finnish time]}
duh.
numbers are lovely strings...
Golf Score: 479

{edit 02:45}
I quess it's time for me to go to bed...
Golf Score: 473

[ 19. August 2002, 01:43: Message edited by: Lonkero ]
_________________________
!

download KiXnet

Top
#69149 - 2002-08-19 07:59 PM Re: KiXtart Golf Tournament IV: Anagrams
Anonymous
Unregistered


Golf score = 483
only 10 behind!

Jens - Technical question.

If the input array is empty or there are no matches,
what do you want returned ?

a) An unassigned variable (VarType = Empty)
b) An empty string (VarType = String)
c) An array containing only (a) above*
d) An array containing only (b) above*

(* array consists of one dimension ie UBOUND($OutputArray) = 0)

[ 19. August 2002, 21:14: Message edited by: AJH ]

Top
#69150 - 2002-08-19 09:26 PM Re: KiXtart Golf Tournament IV: Anagrams
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
I think then the output should be empty...
or 0 lenght string or something like that...
_________________________
!

download KiXnet

Top
#69151 - 2002-08-19 09:31 PM Re: KiXtart Golf Tournament IV: Anagrams
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11164
Loc: Boston, MA, USA
If the input string is empty, then the output string is empty. If the input array is empty, then the output string is empty.
_________________________
There are two types of vessels, submarines and targets.

Top
#69152 - 2002-08-19 09:58 PM Re: KiXtart Golf Tournament IV: Anagrams
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
ajh, I leave you in peace.

I left my laptop at work and at home have only linux-server.
this means, you can freely try to beat my score.
I have to sleep.

as you got so close I can assume only that your code is same as mine before... or it uses really fully different syntax. if latter, you might even get ahead of me.
_________________________
!

download KiXnet

Top
#69153 - 2002-08-20 01:15 AM Re: KiXtart Golf Tournament IV: Anagrams
Anonymous
Unregistered


If I read Jens correctly then no anagrams should produce a variable as the result
(vartype 'Empty' Ubound = -1), and I have a score of 477
(so near and yet so far [Frown] ).
If on the other hand no anagrams can produce an empty array
(vartype = Variant[] with Ubound = 0, Result[0] = Empty)
then I can get 468.

So Lonkero still rules!

Top
#69154 - 2002-08-20 04:13 AM Re: KiXtart Golf Tournament IV: Anagrams
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11164
Loc: Boston, MA, USA
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.

Top
#69155 - 2002-08-20 07:01 AM Re: KiXtart Golf Tournament IV: Anagrams
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
AJH, How can I still rule if you are almost 10 ahead of me?
I also have code shrunk some much, I can't do anything to it anymore.

and I think my code size propably rises on the explicit string on output. uttleast 4 chars.
_________________________
!

download KiXnet

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

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
Still trying...

feeling fleeing
snooped spooned
last salt slat
ablest bleats stable tables
The Anagram() UDF passed validation

KixGolf score = 470

{edit}
KixGolf score = 467

{edit}
KixGolf score = 464

{edit}
KixGolf score = 462

{edit}
KixGolf score = 458

[ 20. August 2002, 09:34: Message edited by: Howard Bullock ]
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#69157 - 2002-08-20 09:34 AM Re: KiXtart Golf Tournament IV: Anagrams
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
hoby, you seem to be rocking today.
I can't get any of the strokes out and you just cut them like they were just air.

I think I must start reorganizing my udf...
_________________________
!

download KiXnet

Top
#69158 - 2002-08-20 09:36 AM Re: KiXtart Golf Tournament IV: Anagrams
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
I soooo tired, but I can't stop. [Big Grin]
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#69159 - 2002-08-20 10:16 AM Re: KiXtart Golf Tournament IV: Anagrams
MightyR1 Offline
MM club member
*****

Registered: 1999-09-09
Posts: 1264
Loc: The Netherlands
Got it working without sorting; Score = 267

Be back later with sorting (if I get it working!)
_________________________
Greetz,
Patrick Rutten

- We'll either find a way or make one...
- Knowledge is power; knowing how to find it is more powerful...
- Problems don't exist; they are challenges...

Top
#69160 - 2002-08-20 11:18 AM Re: KiXtart Golf Tournament IV: Anagrams
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
heh...
pat, it just is that the sorting makes it big.

my script would be just 100 chars without it.
_________________________
!

download KiXnet

Top
#69161 - 2002-08-20 11:25 AM Re: KiXtart Golf Tournament IV: Anagrams
MightyR1 Offline
MM club member
*****

Registered: 1999-09-09
Posts: 1264
Loc: The Netherlands
just 100?? [Eek!]

Well I won't give up...
_________________________
Greetz,
Patrick Rutten

- We'll either find a way or make one...
- Knowledge is power; knowing how to find it is more powerful...
- Problems don't exist; they are challenges...

Top
#69162 - 2002-08-20 04:03 PM Re: KiXtart Golf Tournament IV: Anagrams
Anonymous
Unregistered


Jens 4 tests put me back up to 487 [Frown]
Top
Page 2 of 3 <123>


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

Who's Online
0 registered and 259 anonymous users online.
Newest Members
gespanntleuchten, DaveatAdvanced, Paulo_Alves, UsTaaa, xxJJxx
17864 Registered Users

Generated in 0.075 seconds in which 0.029 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