Page 2 of 9 <12345>Last »
Topic Options
#178181 - 2007-07-23 01:02 PM Re: KiXgolf Freebie: Quicksum [Re: Lonkero]
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
Oh yeah,

not posted official result yet.
This result was with modified kixgolf_qs.kix in line 69 to:
if $iOutput=$iResult and vartype($iResult)=3

 Code:
Running Test 1...Done
Running Test 2...Done
Running Test 3...Done
Running Test 4...Done
Running Test 5...Done
Running Test 6...Done
Your solution passed all tests

KiXtart
KiXtart Version  = 4.53
KiXGolf Script   = KIXGOL~1.KIX

Computer
OS               = Windows 2000 Professional
CPU              =               Intel(R) Pentium(R) 4 CPU 2.80GHz
Speed            = 2793 MHz
Memory           = 504 MB

KiXGolf Scoring Engine
Scoring Engine   = 3.3

KiXtart Golf Score
Tournament       = Quicksum
Processing Start = 2007/07/23 13:02:05.171
Processing End   = 2007/07/23 13:02:05.187
Duration         = 0000/00/00 00:00:00.015
KiXGolf Score    = 85

Thank you for participating in KiXtart Golf!
_________________________



Top
#178182 - 2007-07-23 01:07 PM Re: KiXgolf Freebie: Quicksum [Re: Lonkero]
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
k, now I have 2 saved versions of 85.

Your solution passed all tests

KiXtart
KiXtart Version = 4.53
KiXGolf Script = kixgolf_qs.kix

Computer
OS = Windows XP Professional
CPU = Intel Pentium Model 13
Speed = 1861 MHz
Memory = 1014 MB

KiXGolf Scoring Engine
Scoring Engine = 3.3

KiXtart Golf Score
Tournament = Quicksum
Processing Start = 2007/07/23 14:08:21.015
Processing End = 2007/07/23 14:08:21.031
Duration = 0000/00/00 00:00:00.016
KiXGolf Score = 85
_________________________
!

download KiXnet

Top
#178183 - 2007-07-23 01:08 PM Re: KiXgolf Freebie: Quicksum [Re: Jochen]
Witto Offline
MM club member
*****

Registered: 2004-09-29
Posts: 1828
Loc: Belgium
In contradiction to the rules, I understand there is no private coding phase and it is allowed to post code, isn't it?
Top
#178184 - 2007-07-23 01:09 PM Re: KiXgolf Freebie: Quicksum [Re: Witto]
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
Yeah I think so.

This is just a warmup \:\)
_________________________



Top
#178185 - 2007-07-23 01:12 PM Re: KiXgolf Freebie: Quicksum [Re: Jochen]
Witto Offline
MM club member
*****

Registered: 2004-09-29
Posts: 1828
Loc: Belgium
Can't wait to post... I just do not see shorter ways.
Top
#178186 - 2007-07-23 01:16 PM Re: KiXgolf Freebie: Quicksum [Re: Witto]
Witto Offline
MM club member
*****

Registered: 2004-09-29
Posts: 1828
Loc: Belgium
Is it allowed to change
Function a($)
to i.e.
Function a($b)
?

Top
#178188 - 2007-07-23 01:22 PM Re: KiXgolf Freebie: Quicksum [Re: Witto]
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11164
Loc: Boston, MA, USA
Will make appropriate correction for the VARTYPE() test.
Yes, the variable names inside the UDF can be changed, rule #12.
_________________________
There are two types of vessels, submarines and targets.

Top
#178189 - 2007-07-23 01:29 PM Re: KiXgolf Freebie: Quicksum [Re: Sealeopard]
Witto Offline
MM club member
*****

Registered: 2004-09-29
Posts: 1828
Loc: Belgium
Here is my code good for a KiXGolf Score of 93
 Code:
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
#178190 - 2007-07-23 01:41 PM Re: KiXgolf Freebie: Quicksum [Re: Witto]
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
mine and probably Allans and Jooels 85:

 Code:
Function a($i)
    dim $, $_
    for $ = 1 to len($i)
        $_ = asc(substr($i,$))-64
        if $_ > 0
            $a = $a + $ * $_
;        endif
;    next
EndFunction 
_________________________



Top
#178191 - 2007-07-23 01:48 PM Re: KiXgolf Freebie: Quicksum [Re: Witto]
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
Witto,

here is yours for a score of 91

 Code:
Function a($b)
	Dim $, $c
	For $ = 0 to Len($b)
		$c = Asc(SubStr($b,$))-64
		$a = IIf($c<0,0,$c)*$ + $a
EndFunction
_________________________



Top
#178192 - 2007-07-23 02:35 PM Re: KiXgolf Freebie: Quicksum [Re: Jochen]
Witto Offline
MM club member
*****

Registered: 2004-09-29
Posts: 1828
Loc: Belgium
Could have guessed that Asc() only evaluates the first character in a string.
Top
#178193 - 2007-07-23 02:35 PM Re: KiXgolf Freebie: Quicksum [Re: Witto]
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
_________________________



Top
#178194 - 2007-07-23 02:39 PM Re: KiXgolf Freebie: Quicksum [Re: Jochen]
Arend_ Moderator Offline
MM club member
*****

Registered: 2005-01-17
Posts: 1894
Loc: Hilversum, The Netherlands
Here's mine for a score of 121
 Code:
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
#178195 - 2007-07-23 02:41 PM Re: KiXgolf Freebie: Quicksum [Re: Arend_]
Witto Offline
MM club member
*****

Registered: 2004-09-29
Posts: 1828
Loc: Belgium
At first glance: drop the loop at the end
Top
#178196 - 2007-07-23 02:52 PM Re: KiXgolf Freebie: Quicksum [Re: Witto]
Witto Offline
MM club member
*****

Registered: 2004-09-29
Posts: 1828
Loc: Belgium
  • Replace the
     Code:
      $x = 1
      While $x <= Len($)
    ...
        $x=$x+1
      Loop
    

    by
     Code:
      For $x = 1 to Len($)
    ...
      ;Next
    
  • Name your most used variable $

Top
#178197 - 2007-07-23 02:53 PM Re: KiXgolf Freebie: Quicksum [Re: Witto]
Arend_ Moderator Offline
MM club member
*****

Registered: 2005-01-17
Posts: 1894
Loc: Hilversum, The Netherlands
 Originally Posted By: Witto
At first glance: drop the loop at the end

Thx for the suggestions but ehm, I don't mean to be ingratefull or anything it was just my 2nd attempt overall, haven't had the time yet to optimize since I am at work. This was just getting it working \:\)

Top
#178198 - 2007-07-23 02:56 PM Re: KiXgolf Freebie: Quicksum [Re: Arend_]
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
The loop at the end, the 3rd parameter of asc(), two parentheses, starting with null placing the increment at the top saves us the endif,
results in 121 - 25 = 96

 Code:
Function a($)
  Dim $x, $y
  While $x <= Len($)
    $x=$x+1
    $y = Asc(SubStr($,$x))
    If $y>64
        $a=$a+$x*($y-64)
;    EndIf
;  Loop
EndFunction
_________________________



Top
#178199 - 2007-07-23 02:59 PM Re: KiXgolf Freebie: Quicksum [Re: Arend_]
Arend_ Moderator Offline
MM club member
*****

Registered: 2005-01-17
Posts: 1894
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
 Code:
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
#178200 - 2007-07-23 03:05 PM Re: KiXgolf Freebie: Quicksum [Re: Arend_]
Witto Offline
MM club member
*****

Registered: 2004-09-29
Posts: 1828
Loc: Belgium
the For/Next makes the $=$+1 redundant
Because of that, you can drop the preceeding EndIf

Top
#178201 - 2007-07-23 03:07 PM Re: KiXgolf Freebie: Quicksum [Re: Witto]
Arend_ Moderator Offline
MM club member
*****

Registered: 2005-01-17
Posts: 1894
Loc: Hilversum, The Netherlands
edited my last post
Top
Page 2 of 9 <12345>Last »


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

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

Generated in 0.075 seconds in which 0.026 seconds were spent on a total of 14 queries. Zlib compression enabled.

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