Page 1 of 9 12345>Last »
Topic Options
#178152 - 2007-07-23 01:57 AM KiXgolf Freebie: Quicksum
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11162
Loc: Boston, MA, USA
=============
The Challenge: Quicksum
=============


A checksum is an algorithm that scans a packet of data and returns a single number. The idea is that if the packet is changed, the checksum will also change, so checksums are often used for detecting transmission errors, validating document contents, and in many other situations where it is necessary to detect undesirable changes in data.

For this problem, you will implement a checksum algorithm called Quicksum. A Quicksum packet allows only uppercase letters and spaces. It always begins and ends with an uppercase letter. Otherwise, spaces and letters can occur in any combination, including consecutive spaces.

A Quicksum is the sum of the products of each character's position in the packet times the character's value. A space has a value of zero, while letters have a value equal to their position in the alphabet. So, A=1, B=2, etc., through Z=26.

Here are example Quicksum calculations for the packets "ACM" and "MID CENTRAL":
 Code:
        ACM: 1*1  + 2*3 + 3*13 = 46

MID CENTRAL: 1*13 + 2*9 + 3*4 + 4*0 + 5*3 + 6*5 + 7*14 + 8*20 + 9*18 + 10*1 + 11*12 = 650



A download is available at http://s91376351.onlinehome.us/kixtart/KiXgolf_Quicksum.zip

=============
Inputs & Outputs
=============


Input: A packet containing 1 to 255 characters

Output: An integer denoting the Quicksum of the input packet

=======
Scoring
=======


The solution must pass all tests in order for it's KiXgolf Score to be considered.

When posting KiXtart Golf Scores, please include the KIXGOLF_*.TXT file that is created in the script directory. It contains some basic information about the computer that the script is run on and the resulting scores.

============
Test program
============


Test cases are provided to help screen entries and to provide the Golf Score.
Any script that passes the test cases can be submitted. If you are surprised that your solution passed the test cases, please submit it anyway! That will help me identify bugs in the test program.

================================================================
KiXtart GOLF - How To Play
================================================================


Most importantly, anybody can play, no age restrictions, no penalties, no handicap!

The object in "real" golf is to hit the ball in the hole in the fewest strokes. The object in KiXtart Golf is to get from input (tee) to target (hole) in the fewest keystrokes.

Example: How many positive elements are in array $a?

Array $a could be of structure $a=[1, 2 ,-3, 4, -5, -7, 8, 9]

One approach:
 Code:
for $b=0 to ubound($a)
  if $a[$b]>0
    $c=$c+1
  endif
next

for a score of 45.

Another solution is:
 Code:
DO
  $b=$b+1
  if $a[$b]>0
    $c=$c+1
  endif
UNTIL $b>(UBOUND($a)+1)

for a score of 53.

Better approach: Code sample 1

================================================================
KiXtart GOLF - The Rules
================================================================


1) The goal of KiXtart Golf is to score the lowest strokes.
2) 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 or spaces in between the '=' sign when assigning variables, e.g. '$a = $b' scores 5.
3) Code can be constructed any way you like, as long as it does not generate syntax or other errors when running the script in KiXtart.
4) The final solution MUST pass all test scripts that accompagny the KiXtart golf challenge. Some test scripts may not be included in the publicly available test suite but may be utilized as part of the official KiXgolf score verification.
7) During the private coding phase, no code is allowed to be posted. Violations result in disqualification of said player.
8) During the public coding phase, code should be posted, reused, and borrowed from other players.
9) The test script contains the official KiXgolf scoring engine
10) Only the person posting a particular score will be recognized for the score, unless the KiXtart Golf Challenge organizer or another delegate posts code on behalf of a player
11) KiXtart Golf (a.k.a KiXgolf) codes must be written inside the KiXgolf UDF collection tags, ';!' and ';!;!'
12) Parameter names of the UDF's can be changed and additional optional parameters can be added.
13) Additional helper UDFs can be written as long as they reside inside the ';!' and ';!;!' tags.
14) The use of '$' as a variable is allowed.
15) The UDF layout is up to coder.
16) The UDF is expected to finish in a reasonable time, that is, on modern computers inside 1 hour timeframe.
17) You can submit scores as often as you want.
18) If you reach leading score, you are obligated to post your score immediately so others can try to compete with you.
19) The UDF may only use the KiXtart/KiXforms commands/functions/macros, no other code fragments are allowed.
20) Calls to COM components that are part of a standard default Windows installation are allowed.
21) The use of the KiXforms DLL is also permitted as the KiXforms DLL can now be considered an integral part of KiXtart scripting.
22) Calls to other executables, as long as they are part of a standard default Windows installation are allowed.
23) The UDF should be self-contained (except for any I/O mentioned in the challenge). In particular, you may not do things like fetching extra data from a remote site or file.
24) You may assume ASCII as character set.
25) You may use block comments as the KiXgolf Scoring Engine now supports block comments.
26) You are allowed to only use publicly available versions of KiXtart and KiXforms, private builds or alpha builds are NOT allowed.
27) Your submitted score must include the result print of the KiXgolf test-engine.
28) The SETOPTION() parameters in the KiXgolf script may not be modified and will govern the script behavior. SETOPTION() parameters may change depending on the particular needs of the KiXgolf challenge.
29) Tokenizing the UDF, script, or portions thereof is not allowed.
30) If something is not explicitly denied by the rules, it's allowed.
31) If Confusion arises, arranger of the KiXgolf round has the final say.


================================================================
KiXtart GOLF - The Duration of the Competition
================================================================


Open ended combined private/public round. There's no private coding round per se but you can definitley hold off posting your code solutions until a couple of other participants have posted KiXgolf scores

A download is available at http://s91376351.onlinehome.us/kixtart/KiXgolf_Quicksum.zip
_________________________
There are two types of vessels, submarines and targets.

Top
#178157 - 2007-07-23 06:54 AM Re: KiXgolf Freebie: Quicksum [Re: Sealeopard]
Allen Administrator Online   shocked
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4511
Loc: USA
Jens...

What's the point of the vartype check here:

if $iOutput=$iResult and vartype($iResult)=2

My results are failing because the vartype=3

For example:

 Quote:

Running Test 1...
Expecting 46
Recieved 46
Vartype 3
Done

Running Test 2...
Expecting 650
Recieved 650
Vartype 3
Done

Running Test 3...
Expecting 4690
Recieved 4690
Vartype 3
Done

Running Test 4...
Expecting 75
Recieved 75
Vartype 3
Done

Running Test 5...
Expecting 434
Recieved 434
Vartype 3
Done

Running Test 6...
Expecting 1960
Recieved 1960
Vartype 3
Done

Your solution failed 6 of 6 tests.


Edited by Allen (2007-07-23 07:06 AM)

Top
#178158 - 2007-07-23 07:19 AM Re: KiXgolf Freebie: Quicksum [Re: Allen]
Allen Administrator Online   shocked
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4511
Loc: USA
If my results are correct...

KiXGolf Score = 89

Top
#178160 - 2007-07-23 07:40 AM Re: KiXgolf Freebie: Quicksum [Re: Allen]
Allen Administrator Online   shocked
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4511
Loc: USA
KiXGolf Score = 85
Top
#178163 - 2007-07-23 09:14 AM Re: KiXgolf Freebie: Quicksum [Re: Allen]
Jochen Administrator Offline
KiX Supporter
*****

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

I don't think that we are able to produce Vartype 2 results (integer),
You should change the verification to vartype = 3 (long integer) ;\)

btw. first result :

 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 failed 6 of 6 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 09:14:26.343
Processing End   = 2007/07/23 09:14:26.359
Duration         = 0000/00/00 00:00:00.015
KiXGolf Score    = 128

Thank you for participating in KiXtart Golf!
_________________________



Top
#178164 - 2007-07-23 09:17 AM Re: KiXgolf Freebie: Quicksum [Re: Jochen]
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
KixGolf Score = 114
_________________________



Top
#178166 - 2007-07-23 09:26 AM Re: KiXgolf Freebie: Quicksum [Re: Jochen]
Jochen Administrator Offline
KiX Supporter
*****

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



Top
#178167 - 2007-07-23 09:36 AM Re: KiXgolf Freebie: Quicksum [Re: Jochen]
Jochen Administrator Offline
KiX Supporter
*****

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



Top
#178168 - 2007-07-23 09:38 AM Re: KiXgolf Freebie: Quicksum [Re: Jochen]
Jochen Administrator Offline
KiX Supporter
*****

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

Still some strokes left to catch Allen
_________________________



Top
#178169 - 2007-07-23 09:41 AM Re: KiXgolf Freebie: Quicksum [Re: Jochen]
Jochen Administrator Offline
KiX Supporter
*****

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



Top
#178170 - 2007-07-23 09:47 AM Re: KiXgolf Freebie: Quicksum [Re: Jochen]
Jochen Administrator Offline
KiX Supporter
*****

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

Nice simple challenge \:\)
_________________________



Top
#178171 - 2007-07-23 10:16 AM Re: KiXgolf Freebie: Quicksum [Re: Jochen]
Jochen Administrator Offline
KiX Supporter
*****

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



Top
#178172 - 2007-07-23 10:32 AM Re: KiXgolf Freebie: Quicksum [Re: Jochen]
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
87
Top
#178173 - 2007-07-23 10:35 AM Re: KiXgolf Freebie: Quicksum [Re: Richard H.]
Jochen Administrator Offline
KiX Supporter
*****

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

Now I should have the same as Allan
_________________________



Top
#178175 - 2007-07-23 11:49 AM Re: KiXgolf Freebie: Quicksum [Re: Jochen]
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22343
Loc: OK
KiXtart Golf Score
Tournament = Quicksum
Processing Start = 2007/07/23 12:50:07.203
Processing End = 2007/07/23 12:50:07.218
Duration = 0000/00/00 00:00:00.014
KiXGolf Score = 88
_________________________
!

download KiXnet

Top
#178176 - 2007-07-23 11:50 AM Re: KiXgolf Freebie: Quicksum [Re: Lonkero]
Jochen Administrator Offline
KiX Supporter
*****

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

can we expect a score less than ours?
_________________________



Top
#178177 - 2007-07-23 11:51 AM Re: KiXgolf Freebie: Quicksum [Re: Lonkero]
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22343
Loc: OK
KiXGolf Score = 87
_________________________
!

download KiXnet

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

Registered: 2005-01-17
Posts: 1883
Loc: Hilversum, The Netherlands
KixGolf Score = 145 :P
Top
#178179 - 2007-07-23 12:35 PM Re: KiXgolf Freebie: Quicksum [Re: Jochen]
Witto Offline
MM club member
*****

Registered: 2004-09-29
Posts: 1828
Loc: Belgium
Great, KiXgolf
Shouldn't the rules be modified to the game?
 Originally Posted By: sealeopard

7) During the private coding phase, no code is allowed to be posted. Violations result in disqualification of said player.

 Originally Posted By: sealeopard

There's no private coding round per se but you can definitley hold off posting your code solutions until a couple of other participants have posted KiXgolf scores

  • I presume the INPUT strings in the INI file are always uppercase?
  • I presume I can rename the function name and parameters in kixgolf_qs.udf?
  • I also changed
    If $iOutput=$iResult And VarType($iResult)=2
    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   = kixgolf_qs.kix

Computer
OS               = Windows XP Professional
CPU              = Intel Pentium Model 15
Speed            = 1995 MHz
Memory           = 2040 MB

KiXGolf Scoring Engine
Scoring Engine   = 3.3

KiXtart Golf Score
Tournament       = Quicksum
Processing Start = 2007/07/23 12:33:25.817
Processing End   = 2007/07/23 12:33:25.817
Duration         = 0000/00/00 00:00:00.000
KiXGolf Score    = 93

Thank you for participating in KiXtart Golf!

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

Registered: 2001-06-05
Posts: 22343
Loc: OK
lol.
already got 3 totally different codes at 87 :P
_________________________
!

download KiXnet

Top
Page 1 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 131 anonymous users online.
Newest Members
vertage, dimi575, Drecksnacken, Nlill, webtools321
17735 Registered Users

Generated in 0.083 seconds in which 0.052 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