Page 3 of 9 <12345>Last »
Topic Options
#178202 - 2007-07-23 03:07 PM Re: KiXgolf Freebie: Quicksum [Re: Arend_]
Jochen Administrator Offline
KiX Supporter
*****

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

-no need to increment $
-the parentheses surrounding the multiplication are superflous as the priority rule of multiplication before addition is valid here too
-AND $y<91 can also be ommitted
_________________________



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

Registered: 2005-01-17
Posts: 1895
Loc: Hilversum, The Netherlands
91:
 Code:
Function a($)
  Dim $x, $y
  For $x = 0 to Len($)
    $y = Asc(SubStr($,$x))
    If $y>64 $a=$a+($x*($y-64))
EndFunction

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

Registered: 2005-01-17
Posts: 1895
Loc: Hilversum, The Netherlands
90:
 Code:
Function a($b)
  Dim $, $y
  For $ = 0 to Len($b)
    $y = Asc(SubStr($b,$))
    If $y>64 $a=$a+($*($y-64))
EndFunction

Presumably final code, basically not mine anymore but Witto's and Jochen's code.

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

Registered: 2004-09-29
Posts: 1828
Loc: Belgium
Now you have twice 64 in your code
substract it directly here
$y = Asc(SubStr($b,$))-64
Now evaluate for > 0
If $y>0 $a=$a+($*$y)

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

Registered: 2005-01-17
Posts: 1895
Loc: Hilversum, The Netherlands
 Originally Posted By: Witto
Now you have twice 64 in your code
substract it directly here
$y = Asc(SubStr($b,$))-64
Now evaluate for > 0
If $y>0 $a=$a+($*$y)

that makes 87:
 Code:
Function a($b)
  Dim $, $y
  For $ = 0 to Len($b)
    $y = Asc(SubStr($b,$))-64
    If $y>0 $a=$a+($*$y)
EndFunction

Top
#178207 - 2007-07-23 03:21 PM Re: KiXgolf Freebie: Quicksum [Re: Arend_]
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
I don't see why you still insist on parenthesing your multiplications ;\)
_________________________



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

Registered: 2004-09-29
Posts: 1828
Loc: Belgium
 Originally Posted By: apronk
Presumably final code, basically not mine anymore but Witto's and Jochen's code.

Don't think so. The solutions are very resembling.
I think it is a good exercise to see how we think and to get to know the little tricks that can golf the score

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

Registered: 2005-01-17
Posts: 1895
Loc: Hilversum, The Netherlands
 Originally Posted By: Jochen
I don't see why you still insist on parenthesing your multiplications ;\)

True, not needed anymore
85:
 Code:
Function a($b)
  Dim $, $y
  For $=0 to Len($b)
    $y=Asc(SubStr($b,$))-64
    If $y>0 $a=$a+$*$y
EndFunction


Witto: You are right, this was my first KixGolf participation \:\)

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

Registered: 2004-09-29
Posts: 1828
Loc: Belgium
That gives you at least 1 point for participating \:D
Top
#178212 - 2007-07-23 03:35 PM Re: KiXgolf Freebie: Quicksum [Re: Witto]
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
My slightly different approach. More shots (86), but I get to see more of the unusual scenery ;\)

 Code:
Function a($)
	Dim $i,$s
	While $
		$i=$i+1
		$s=Asc($)-64
		$=SubStr($,2)
		$a=$a+$i*$s*($s>)
EndFunction

Top
#178213 - 2007-07-23 03:56 PM Re: KiXgolf Freebie: Quicksum [Re: Witto]
acmp Offline
Getting the hang of it

Registered: 2004-07-02
Posts: 69
Loc: Bingham, Nottinghamshire, Engl...
I've got a respectable 99 for my first ever go at kixgolf. I'm happy.

when do we post code?

[edit]
Oop's just refereshed the list and saw all the code.


Edited by acmp (2007-07-23 03:57 PM)
Edit Reason: stupid me
_________________________
Every day is a school day

Top
#178215 - 2007-07-23 04:03 PM Re: KiXgolf Freebie: Quicksum [Re: acmp]
acmp Offline
Getting the hang of it

Registered: 2004-07-02
Posts: 69
Loc: Bingham, Nottinghamshire, Engl...
Just reviewed some code and got down to 90

Is it really ok to not close If's and other loops?

Any way, my code is:
 Code:
Function a($)
dim  $q, $w
for $q = 1 to len($)
	$w=asc(substr($,$q,1))-64
	if $w>0 $a=$a+($w*$q)
endfunction
_________________________
Every day is a school day

Top
#178216 - 2007-07-23 04:09 PM Re: KiXgolf Freebie: Quicksum [Re: acmp]
Witto Offline
MM club member
*****

Registered: 2004-09-29
Posts: 1828
Loc: Belgium
that looks like the code Jochen posted.
$a+$w*$q is the same as $a+($w*$q)
Maybe you can replace $q or $q by $.

Top
#178218 - 2007-07-23 04:14 PM Re: KiXgolf Freebie: Quicksum [Re: Richard H.]
Allen Administrator Offline
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4549
Loc: USA
Your solution passed all tests

KiXtart
KiXtart Version = 4.53
KiXGolf Script = kixgolf_qs.KIX

Computer
OS = Windows Vista Business Edition
CPU = AMD Athlon(tm) 64 X2 Dual Core Processor 5000+
Speed = 2604 MHz
Memory = 2048 MB

KiXGolf Scoring Engine
Scoring Engine = 3.3

KiXtart Golf Score
Tournament = Quicksum
Processing Start = 2007/07/23 10:17:54.661
Processing End = 2007/07/23 10:17:54.677
Duration = 0000/00/00 00:00:00.016
KiXGolf Score = 83

Thank you for participating in KiXtart Golf!

Top
#178220 - 2007-07-23 04:31 PM Re: KiXgolf Freebie: Quicksum [Re: Allen]
acmp Offline
Getting the hang of it

Registered: 2004-07-02
Posts: 69
Loc: Bingham, Nottinghamshire, Engl...
Good score Allen,

any clues?
_________________________
Every day is a school day

Top
#178221 - 2007-07-23 04:37 PM Re: KiXgolf Freebie: Quicksum [Re: acmp]
acmp Offline
Getting the hang of it

Registered: 2004-07-02
Posts: 69
Loc: Bingham, Nottinghamshire, Engl...
After a clarification,

Is
 Code:
function a($b)

legal?

I didn't think you could edit the base code. So, I'm at 86, or 85 if I cheat.
_________________________
Every day is a school day

Top
#178222 - 2007-07-23 04:39 PM Re: KiXgolf Freebie: Quicksum [Re: acmp]
Allen Administrator Offline
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4549
Loc: USA
I'm waiting on a few others to post scores yet... ;\)

Here's a hint acmp. ()

Top
#178223 - 2007-07-23 04:50 PM Re: KiXgolf Freebie: Quicksum [Re: acmp]
acmp Offline
Getting the hang of it

Registered: 2004-07-02
Posts: 69
Loc: Bingham, Nottinghamshire, Engl...
Had a genius moment:


Your solution passed all tests

KiXtart
KiXtart Version = 4.53
KiXGolf Script = kixgolf_qs.kix

Computer
OS = Windows XP Professional
CPU = Intel(R) Pentium(R) 4 CPU 3.00GHz
Speed = 2992 MHz
Memory = 1022 MB

KiXGolf Scoring Engine
Scoring Engine = 3.3

KiXtart Golf Score
Tournament = Quicksum
Processing Start = 2007/07/23 15:52:58.464
Processing End = 2007/07/23 15:52:58.510
Duration = 0000/00/00 00:00:00.046
KiXGolf Score = 83

Thank you for participating in KiXtart Golf!
Could be 82 with the cheat!


Edited by acmp (2007-07-23 04:53 PM)
Edit Reason: updated return info, was the _QS.txt file
_________________________
Every day is a school day

Top
#178224 - 2007-07-23 04:54 PM Re: KiXgolf Freebie: Quicksum [Re: Richard H.]
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
Very Nice Richard,

here is a 85 based on yours ;\)

 Code:
Function a($)
	Dim $i,$s
	While $
		$i=$i+1
		$s=Asc($)-64
		$=Right($,~)
		$a=$a+$i*$s*($s>)
EndFunction


Edited by Jochen (2007-07-23 04:57 PM)
Edit Reason: whoops, there was quite a bit going on meanwhile
_________________________



Top
#178225 - 2007-07-23 05:00 PM Re: KiXgolf Freebie: Quicksum [Re: Jochen]
Allen Administrator Offline
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4549
Loc: USA
wait a minute... I didn't give you that good of a hint... hmmmm must be more to find
Top
Page 3 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 718 anonymous users online.
Newest Members
Timothy, Jojo67, MaikSimon, kvn317, kixtarts2025
17874 Registered Users

Generated in 0.082 seconds in which 0.03 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