Page 1 of 1 1
Topic Options
#180735 - 2007-09-19 07:51 PM KixGolf NOT =
Gargoyle Offline
MM club member
*****

Registered: 2004-03-09
Posts: 1597
Loc: Valley of the Sun (Arizona, US...
Ok, we have had two Golf rounds very recently. I would like to have one of the great's here please take any of the codes and document what it is they are doing so that I can learn from it.

thanks


Edited by Gargoyle (2007-09-19 07:52 PM)
Edit Reason: typo
_________________________
Today is the tomorrow you worried about yesterday.

Top
#180738 - 2007-09-19 08:16 PM Re: KixGolf NOT = [Re: Gargoyle]
DrillSergeant Offline
MM club member
*****

Registered: 2004-07-09
Posts: 1164
Loc: Eijsden, the Netherlands
hey Gargoyle,

$ is accepted as the shortest variable name, so you give this name to the variable you use the most.

($^) is the same as Len($) (but shorter)
$^0 is one shorter than the one above, but this is not always allowed by the interpreter

if $a | $b means if $a OR $b
if $a & $b means if $a AND $b

Loops do not have to be closed if the closing line is the last line of the function

These are a couple of golfing tricks, are there any specific others that you'd like to know about?
_________________________
The Code is out there

Top
#180740 - 2007-09-19 09:30 PM Re: KixGolf NOT = [Re: DrillSergeant]
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
say, you want to know about the scores! \:\)
_________________________
!

download KiXnet

Top
#180741 - 2007-09-19 09:55 PM Re: KixGolf NOT = [Re: Lonkero]
Gargoyle Offline
MM club member
*****

Registered: 2004-03-09
Posts: 1597
Loc: Valley of the Sun (Arizona, US...
Drill,
What would be great is to actually grab one of the winning codes and break down the entire thing - You know the one with highest score wins \:\)
_________________________
Today is the tomorrow you worried about yesterday.

Top
#180751 - 2007-09-20 06:48 AM Re: KixGolf NOT = [Re: Gargoyle]
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
yep.
it has been done previously and I bet someone gets bored and will do it once again but afaik, the actual way for you to really learn is to try and break the code apart yourself.

if the code gets bloated every time by some golfer, the end result is that you are gonna ask for bloated version for the rest of your scripting life. and then some.
_________________________
!

download KiXnet

Top
#180753 - 2007-09-20 07:10 AM Re: KixGolf NOT = [Re: Lonkero]
Gargoyle Offline
MM club member
*****

Registered: 2004-03-09
Posts: 1597
Loc: Valley of the Sun (Arizona, US...
Jooel,
You make a good point. If life ever settles down around here I just may do that.
_________________________
Today is the tomorrow you worried about yesterday.

Top
#180770 - 2007-09-21 05:59 PM Re: KixGolf NOT = [Re: Gargoyle]
Bryce Offline
KiX Supporter
*****

Registered: 2000-02-29
Posts: 3167
Loc: Houston TX
I have always wondered about this little bit in the scoring of those golf games...

$ is a variable, it is counted as one stroke.

$a is also a variable, but it is counted as 2 strokes... $ab = 3 and so on...

why are we counting the letters of a variable as a stroke? the variable it self is a stroke.

Just like instr() is 1 stroke, vs substr() is 1 stroke, but if i understand the rules, instr() is counted as 7 vs substr() 8.

In real golf, if you putted with a driver, would you add + 3 strokes to that one stroke?

Bryce


Edited by Bryce (2007-09-21 06:18 PM)

Top
#180771 - 2007-09-21 07:31 PM Re: KixGolf NOT = [Re: Bryce]
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
Part of the golf challenge is reducing the number of variables that you use, and reusing the key $ variable as much as possible.

It is also about not using the obvious functions and constructs, but using less obvious techniques in new and interesting way in order to reduce your score.

Seems like a reasonable way of scoring to me.

In real golf is you loaded your bag with every possible club you'd get a penalty. And a hernia, probably.

Top
Page 1 of 1 1


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

Who's Online
0 registered and 1114 anonymous users online.
Newest Members
Viginette, ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder
17888 Registered Users

Generated in 0.241 seconds in which 0.192 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