Everybody:

After a lot of landscaping a new KiXtart Golf course has just opened!

Rules for KiXtart Golf can be found here: http://81.17.37.55/board/ultimatebb.php?ubb=get_topic;f=2;t=003357

Additionally, based on feedback from the two previous Kixtart Golf challanges (http://81.17.37.55/board/ultimatebb.php?ubb=get_topic;f=2;t=003357, http://81.17.37.55/board/ultimatebb.php?ubb=get_topic;f=2;t=003382) I have update the rules a little bit to make it more fun for everybody.

So, here are the updated rules for Kixtart Golf:
================================================================
KiXtart GOLF - The rules
================================================================

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

How is it scored?
-----------------
Every kystroke will be counted. There is no penalty for obscurity or execution time. UDFs are allowed and will be counted as hits, too. The carriage return character and the space character used to separate commands/functions do not count as strokes.

One can use this function as a scoring UDF: http://81.17.37.55/board/ultimatebb.php?ubb=get_topic;f=2;t=003418 but counting by hand is also allowed.

Additional rules:

All public releases of KiXtart are allowed up to and including KiXtart 4.10 RC2.

Within the first 48 hours or until the time set by the KiXtart Golf organizer, no code can be posted. People who post code will be disqualified. The only thing to be posted within this period is the KiXtart Golf score and the answer to the challange question (if an answer is to be provided).

After this initial period, everybody is allowed to post code and modify other poeple's code, too for another 48 hours. So, somebody is allowed/encouraged to take a posted solution with for example a KiXtart Golf score of 100 and optimize this code to score only 99.

There are a total of three winners based on this approach:
Winner 1) The first person posting the solution to the question (if applicable)
Winner 2) The person with the lowest KiXtart Golf score within the first 48 hour period (first round)
Winner 3) The person with the lowest KiXtart Golf score within the second 48 hour period (second round)

The first round will go from Saturday, June 8, time of postiong to Monday, June 10, 3pm Eastern Standard Time (EST, GMT-6)
The second round will go from Monday, June 10, 3pm EST to Wednesday, June 12, 3pm EST

This will give contestants in all time zones enough time to come up with potential solutions.

=====================================================
And now the challange for KiXtart Golf Tournament III
=====================================================

Write a generic base converter for bases 2-36. BASE10 is the decimal system, BASE2 is the binary system, BASE16 is the hexadecimal system, extensions beyond BASE16 are accomplished by filling up with letters from the English alphabet, so BASE17 would consist of the following values 0123456789ABCDEFG. BASE36 is a special case as it consist of all numbers 0-9 and all letters A-Z. Therefore, all english words can be converted into a BASE10 representation.

Example: (ADD)36 = (10·362 + 13·36 + 13)10 = (13.441)10

The structure for the UDF that is to be created is

$result=BaseConverter($value,$frombase,$tobase)

and I want to know the answer for

$result=BaseConverter('44680832201','10','36')

and the KiXtart Golf score.

Hint: There are two different approaches, one iterative approach and one recursive approach.

[ 08 June 2002, 16:45: Message edited by: sealeopard ]
_________________________
There are two types of vessels, submarines and targets.