#178189 - 2007-07-23 01:29 PM
Re: KiXgolf Freebie: Quicksum
[Re: Sealeopard]
|
Witto
MM club member
Registered: 2004-09-29
Posts: 1828
Loc: Belgium
|
Here is my code good for a KiXGolf Score of 93
Function a($b)
Dim $, $c
For $ = 0 to Len($b)
$c = Asc(SubStr($b,$,1))-64
$a = IIf($c<0,0,$c)*$ + $a
EndFunction
|
Top
|
|
|
|
#178194 - 2007-07-23 02:39 PM
Re: KiXgolf Freebie: Quicksum
[Re: Jochen]
|
Arend_
MM club member
Registered: 2005-01-17
Posts: 1895
Loc: Hilversum, The Netherlands
|
Here's mine for a score of 121
Function a($)
Dim $x, $y
$x = 1
While $x <= Len($)
$y = Asc(SubStr($,$x,1))
If $y>64 AND $y<91 $a=$a+($x*($y-64)) EndIf
$x=$x+1
Loop
EndFunction
|
Top
|
|
|
|
#178196 - 2007-07-23 02:52 PM
Re: KiXgolf Freebie: Quicksum
[Re: Witto]
|
Witto
MM club member
Registered: 2004-09-29
Posts: 1828
Loc: Belgium
|
- Replace the
$x = 1
While $x <= Len($)
...
$x=$x+1
Loop
by
For $x = 1 to Len($)
...
;Next
- Name your most used variable $
|
Top
|
|
|
|
#178199 - 2007-07-23 02:59 PM
Re: KiXgolf Freebie: Quicksum
[Re: Arend_]
|
Arend_
MM club member
Registered: 2005-01-17
Posts: 1895
Loc: Hilversum, The Netherlands
|
Anyway with Witto's suggestions 110: Edit: Witto's suggestions failed the tests. Here are Some of witto's and some of Jochen's suggestions put together for a score of 117
Function a($)
Dim $x, $y
$x = 1
While $x <= Len($)
$y = Asc(SubStr($,$x))
If $y>64 $a=$a+($x*($y-64)) EndIf
$x=$x+1
EndFunction
Edited by apronk (2007-07-23 03:07 PM)
|
Top
|
|
|
|
Moderator: Arend_, Allen, Jochen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Mart
|
0 registered
and 718 anonymous users online.
|
|
|