Page 2 of 3 <123>
Topic Options
#66045 - 2002-06-05 01:21 PM Re: KixGolf scoring script
DrillSergeant Offline
MM club member
*****

Registered: 2004-07-09
Posts: 1164
Loc: Eijsden, the Netherlands
The Sarge is jumping up and down, yelling: can I play? can I play? please, please, please !!!

[Wink] [Big Grin]

[ 05 June 2002, 13:22: Message edited by: DrillSergeant ]
_________________________
The Code is out there

Top
#66046 - 2002-06-05 02:27 PM Re: KixGolf scoring script
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
LOL, as long as you promise to stay - and post at least once a day ! [Wink]

Howard, Jens, I'm getting a little nervous now - all these other big guns want a piece of the action - afraid my Kixtart slice might come back to haunt me ...

-Shawn

[nice to see you back my friend - missed you !]

Top
#66047 - 2002-06-05 03:43 PM Re: KixGolf scoring script
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11164
Loc: Boston, MA, USA
Okay, just to make it official: Despite having a dead computer at home right now (messed up the BOOT.INI during a repartitioning operation [and yes, I do have a backup ;-)]) I am already designing a new course. It will be posted on Saturday morning EST and will contain updated rules for KiXtart Golf to make it a) more challenging, b) more interesting, c) give you the chance of messing with others people's code, too.

I am also soliciting ideas for the coding challenge, it does not need to be anything practical, though.

I will also give the KiXGolf script a try.

[ 05 June 2002, 16:05: Message edited by: sealeopard ]
_________________________
There are two types of vessels, submarines and targets.

Top
#66048 - 2002-06-05 05:18 PM Re: KixGolf scoring script
BrianTX Offline
Korg Regular

Registered: 2002-04-01
Posts: 895
You're right, Howard. The problem with the quotes was in MY script, not yours. [Smile] I had just assumed you had to work around it as well. After counting, I think I only saved about 5 keystrokes total in the script. [Big Grin]

Brian

Top
#66049 - 2002-06-05 05:47 PM Re: KixGolf scoring script
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
We seem to concur...

KixGolf.kix is my code
KixGolf2.kix is Brian's code

C:\Data\Scripts>%tmp%\kix32 kixgolf.kix $A=KixGolf.kix

KixGolf score = 393

C:\Data\Scripts>%tmp%\kix32 kixgolf.kix $A=KixGolf2.kix

KixGolf score = 335

C:\Data\Scripts>%tmp%\kix32 kixgolf2.kix $F=KixGolf.kix

KixGolf score = 393

C:\Data\Scripts>%tmp%\kix32 kixgolf2.kix $F=KixGolf2.kix

KixGolf score = 335

[ 05 June 2002, 17:48: Message edited by: Howard Bullock ]
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#66050 - 2002-06-05 07:54 PM Re: KixGolf scoring script
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
Ok, probably too late to mention this (and may be repetitive) but I always thought what we were counting was the "non-white-space" in the script. The way I was doing that was with Microsoft Word and the "wordcount" option in the Tools menu. Specifically the Character Count reported under that. If I take Howards script, and strip-out the comments, I get a count of 385 characters. Does that make sense ? Why the descrepency ?

Sorry for bumping this to the top again - but I mean, we should sort this out because, by my reckoning, we got two scripts that report different results, yeah ?

ps. oops. is that because your are counting the whitespace inside quotes, right ?

[ 05 June 2002, 19:57: Message edited by: Shawn ]

Top
#66051 - 2002-06-05 07:59 PM Re: KixGolf scoring script
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
Hey Jens, There a bunch of stuff on this board that isn't practical...

Why should this be any different? [Big Grin]
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#66052 - 2002-06-05 08:16 PM Re: KixGolf scoring script
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
Yes Shawn I have 8 white-space characters in quotes. That added to your 385 makes 393.

I am glad to see that the code was at least executed a few times. [Big Grin]

[ 05 June 2002, 20:17: Message edited by: Howard Bullock ]
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#66053 - 2002-06-05 08:24 PM Re: KixGolf scoring script
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11164
Loc: Boston, MA, USA
Whitespace (actually anything) inside quotes does count. So
code:
? 'This is a text!'

should result in a score of 18 since only the space between ? and doesn't count.
_________________________
There are two types of vessels, submarines and targets.

Top
#66054 - 2002-06-05 08:28 PM Re: KixGolf scoring script
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
Jens, it appears that your right! [Big Grin]

C:\Data\Scripts>%tmp%\kix32 kixgolf.kix $A=junk.txt

KixGolf score = 18

where junk.txt =
code:
? 'This is a text!'  

_________________________
Home page: http://www.kixhelp.com/hb/

Top
#66055 - 2002-06-05 08:36 PM Re: KixGolf scoring script
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11164
Loc: Boston, MA, USA
Yeah, and I did this even without KiXtart [Wink]

Does that make me an old-timer?
_________________________
There are two types of vessels, submarines and targets.

Top
#66056 - 2002-06-05 08:37 PM Re: KixGolf scoring script
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
Right than ... lets hit the links ...


Top
#66057 - 2002-06-07 04:49 PM Re: KixGolf scoring script
BrianTX Offline
Korg Regular

Registered: 2002-04-01
Posts: 895
It seems pretty slow... I wonder when the KixGolf will start?

Brian

Top
#66058 - 2002-06-07 04:53 PM Re: KixGolf scoring script
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11164
Loc: Boston, MA, USA
I already have an idea and will post the next KiXtart Golf challenge on Saturday morning EST.
_________________________
There are two types of vessels, submarines and targets.

Top
#66059 - 2002-07-17 10:14 PM Re: KixGolf scoring script
kholm Offline
Korg Regular
*****

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

[Eek!] [Eek!] [Eek!]

Your KixGolf scoring script is reporting to few point !!!

Each CRLF must be counted as one point (nessesary whitespace)
Also it dosn't count the nessary whitespaces inside the code,
your script will count this code:
code:
If $a>5 $x=1 EndIf

As 15 points
Assuming this would be working KiX-code:
code:
If$a>5$x=1EndIf

The result should be 18, because all the whitespaces are required.

The following UDF, also counts required whitespaces, it might
stil need some minor ajusts.

I have added the possibility to count parts of a script.
If the optional parameter $CountMarkers is used and <> '' or 0 the UDF wil
look for the line:
;GolfStart
before beginning to count
And wil stop counting when the line:
;GolfEnd
is found.

code:
Function KixGolf($A,Optional $CountMarkers)
$SpaceChars=Chr(9)+' ,;=<>()+-*/"'+"'"
If Open(1,$A) = 0
$X=0
If $CountMarkers
Do
$C=ReadLine(1)
Until $C = ';GolfStart'
EndIf
$C=ReadLine(1)
While @Error=0 And $C <> ';GolfEnd'
$InStr = 0
$StrCh = ''
$j=len($C)
For $h=1 To $j
$Ch = substr($C,$h,1)
If $Ch = '"' Or $Ch = "'"
If $InStr
If $Ch = $StrCh
$InStr = 0
EndIf
Else
$InStr = 1
$StrCh = $Ch
EndIf
$X=$X+1 ; Count stringdelimiter
Else
If $InStr
$X=$X+1 ; Count all chars inside strings
Else
$D=Asc($Ch)
If $D=59 ; Ignore comments in rest of line
$h=$j
Else
If $D=9 Or $D=32 ; Space or Tab: Count only if whitespace is demanded
$Count = 1
If InStr($SpaceChars,SubStr($C,$h-1,1))
$Count=0
Else
If InStr($SpaceChars,SubStr($C,$h+1,1))
$Count=0
EndIf
EndIf
$X=$X+$Count
Else
$X=$X+1 ; Count the character
EndIf
EndIf
EndIf
EndIf
Next
$C=Trim(ReadLine(1))
If $C <> '' And Left(Trim($C),1) <> ';'
$X=$X+1 ; Each CRLF counts as one whitespace, If not a full comment-line
EndIf
Loop
$RC=Close(1)
$KixGolf=$X
Else
$KixGolf = "KixGolf, bad filename: " + $A
EndIf
EndFunction

-Erik

ps.
I belive that only expirienced 'KiXters' will use this function, so it is not commented
on how to use.
I won't release it in the UDF section because i am sure it can be improved, and maybe
some of you wil have something to add.
Also, this UDF is of no general use, so maybe this or something similar should be linked
directly to the active Golf tournament.

[ 17 July 2002, 22:19: Message edited by: kholm ]

Top
#66060 - 2002-07-17 10:22 PM Re: KixGolf scoring script
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11164
Loc: Boston, MA, USA
'If$a>5$x=1EndIf' should be 'If $a>5 $x=1 EndIf' and is therefore KiXtart Golf score 18, indeed. Nevertheless, the @CRLF is not counted as per the rules. i am not aware of any programming Golf competition that counts the CRLF as a character.
_________________________
There are two types of vessels, submarines and targets.

Top
#66061 - 2002-07-17 10:26 PM Re: KixGolf scoring script
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
so, we should work around with crlf with maybe 2000000 strokes which is working...
cracking is possible you know.

would be nice to make that sized script with score of 454 [Big Grin]
_________________________
!

download KiXnet

Top
#66062 - 2002-07-17 10:49 PM Re: KixGolf scoring script
kholm Offline
Korg Regular
*****

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

You have to count CRLF as ONE whitespace, because this code is also reported as 15 points
code:
If $a>5
$x=1
EndIf

Statements has to be separated by at least one whitespace, being:
@CRLF
Space
Tabulator

If you omit to count the @CRLF the reported size wil not be of an operational script!!

-Erik

Top
#66063 - 2002-07-18 12:59 AM Re: KixGolf scoring script
kholm Offline
Korg Regular
*****

Registered: 2000-06-19
Posts: 714
Loc: Randers, Denmark
The goal of a golf tournament should be to create the smallest WORKING KiX-script

The current rules state:
Strokes are all characters in a piece of code except whitespace characters, unless the whitespace character is necessary for the line of code to work. Therefore, carriage returns and line feeds do not count.

I my opinion this should be refrased to:
Strokes are all characters in a piece of code except whitespace characters, unless the whitespace character is necessary for the code to work.
@CRLF counts 1 if the line containes code !!!!

If the goal of the golf tournament is to find the size of the smallest possible WORKING KiX-script to accomplish the job @CRLF has to be counted as 1 point when a line containes code.

Observe that @CRLF would normally count as 2. So you do get a small discount [Wink]

-Erik

[ 18 July 2002, 01:16: Message edited by: kholm ]

Top
#66064 - 2002-07-18 01:40 AM Re: KixGolf scoring script
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
I'll let you guys argue this one out. The code I provide strips all white out and counts what left. I have not sat down to to examine all the possibilities where a white space character is or is not required. I do count all spaces within quoted strings. I think that as long as we measure with the same yard/meter stick the judging will be OK, especially when the spread seems to be 1,000 strokes. If the finalist are 1 or 2 strokes off at the end and they want to be so detailed, then they can counted anyway they want.
_________________________
Home page: http://www.kixhelp.com/hb/

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 515 anonymous users online.
Newest Members
gespanntleuchten, DaveatAdvanced, Paulo_Alves, UsTaaa, xxJJxx
17864 Registered Users

Generated in 0.105 seconds in which 0.034 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org