Page 1 of 5 12345>
Topic Options
#66367 - 2002-06-08 04:40 PM KiXtart Golf Tournament Part III !!!
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11164
Loc: Boston, MA, USA
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.

Top
#66368 - 2002-06-08 09:52 PM Re: KiXtart Golf Tournament Part III !!!
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
Are you sure you couldn't have made this one any tougher Jens ? [Wink] And it had to be math too [Wink] And the number conversion your asking for is bigger than what Kixtart supports - oi ! [Wink] Nice puzzle, should keep us a busy for while ...
Top
#66369 - 2002-06-08 10:21 PM Re: KiXtart Golf Tournament Part III !!!
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11164
Loc: Boston, MA, USA
Shawn: Yeah, the math is definitely interesting but I also gave two ways to solve the problem.

And with regards to the number conversion, if I understand the manual for KiXtart 4.10RC2 correctly, then this number should still be within the range of numbers that KiXtart can handle. If this is not the case, I will give it a try, then I will downsize the number to make it still doable.

Nevertheless, the routine itself is definitely doable in Kixtart. Also, I gave 48 hours time, so you don't have to work during the weekend but can attack the problem during the slow hours at work.
_________________________
There are two types of vessels, submarines and targets.

Top
#66370 - 2002-06-08 10:36 PM Re: KiXtart Golf Tournament Part III !!!
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
Well guys, I think I have the logic, but am looking for a way to execute the large numbers.

Ahhh, maybe that will work...
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#66371 - 2002-06-08 10:40 PM Re: KiXtart Golf Tournament Part III !!!
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
Think I got some of the bits and pieces, but I can't get my mind around to put them all together, definitely won't be posting a score anytime soon, but i did figure out the answer (sure others have by now too) very clever.

[ 08 June 2002, 22:41: Message edited by: Shawn ]

Top
#66372 - 2002-06-08 11:33 PM Re: KiXtart Golf Tournament Part III !!!
BrianTX Offline
Korg Regular

Registered: 2002-04-01
Posts: 895
so this has to be a UDF? What should the format of the final result be? Must it include an example of how to run the function?

Function BaseConverter(....)
Endfunction

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

Brian

(I mean does everything count as part of your score? or just what's inside the function?)

{edit}
Are fractional numbers allowed or integers only?

Like 1101.001 Base 2

Brian

{EDIT AGAIN}
Suppose you had a number ZZZZZZZZZ that was base 35. This number is bound to be larger than what kixtart can handle if converted to base 10. Does it need to be handled anyway?..

Ok.. got it to work for smaller numbers. now to figure out how to handle the BIG ones...

[ 09 June 2002, 02:24: Message edited by: BrianTX ]

Top
#66373 - 2002-06-09 03:14 AM Re: KiXtart Golf Tournament Part III !!!
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Hmmm... Vartype not mentioned in the rules. One may infer an ascii (string) representation. A loophole maybe...
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#66374 - 2002-06-09 03:58 AM Re: KiXtart Golf Tournament Part III !!!
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
Howard, how you making out there buddy ? Les - whazzup ? Im a little uncertain about a couple of things ... think we made need some further clarification - the big numbers are causing me grief ... plus, how big of a number must we support ? And the other thing is about negative numbers ... arrggghhh ! mother ! jack !

-Shawn

[ 09 June 2002, 04:01: Message edited by: Shawn ]

Top
#66375 - 2002-06-09 04:14 AM Re: KiXtart Golf Tournament Part III !!!
BrianTX Offline
Korg Regular

Registered: 2002-04-01
Posts: 895
I have it fully working for small numbers.. (that aren't greater than the integer limit for kixtart (base 10)... i'm trying to do it for large numbers another way.. it's taking forever, though!

Brian

{edit}
mine is fully functional now.. however it is SLOW.. (not a requirement, right?).. I'm seeing if I can trim down the code..

[ 09 June 2002, 11:09: Message edited by: BrianTX ]

Top
#66376 - 2002-06-09 04:45 AM Re: KiXtart Golf Tournament Part III !!!
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
I have a working program using large numbers. [Big Grin] Very Fast! 40 ticks!

However it is only base10 to any other base. I have not yet made it generic.

I have found that mod does not work properly with large numbers.

[ 09 June 2002, 04:51: Message edited by: Howard Bullock ]
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#66377 - 2002-06-09 04:47 AM Re: KiXtart Golf Tournament Part III !!!
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
Brian, can you give me some of your test function calls, and your benchmarks. How are you measuring ? using @ticks by msecs ?

Howard, how big is big ? [Big Grin]

[ 09 June 2002, 04:49: Message edited by: Shawn ]

Top
#66378 - 2002-06-09 04:54 AM Re: KiXtart Golf Tournament Part III !!!
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
Preliminary program:
KixGolf score = 379
runs in 40 ticks. [Big Grin] [Big Grin] [Big Grin]

Still have to get generic so that it works for any base to any base. That will cause the code base to grow. [Frown]

[ 09 June 2002, 04:54: Message edited by: Howard Bullock ]
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#66379 - 2002-06-09 05:09 AM Re: KiXtart Golf Tournament Part III !!!
BrianTX Offline
Korg Regular

Registered: 2002-04-01
Posts: 895
When I'm talking slow, i'm meaning SLOW!!!! Just processing the test code will take a few hours.. shorter pieces (3 or 4 characters base 36) take less. Instead of messing around with large numbers, I'm using an incremental method.

I have two sets of code. The first will not handle numbers larger than KiXtart integers... (and runs faster)

The second will handle anything, but runs VERY SLOWLY.

For the slow one (that handles larger numbers) my score is 375.

For the faster one, my score is 243. however it won't do the sample one because the numbers are too large.

If I need to make (the second method) so that it will work for even the huge numbers, I will have to write my own MOD and division functions.

{EDIT} After much thinking about this (and testing some), I believe that adding complexity to my long-running script would indeed speed it up quite a bit, but at the cost of score.. I'm using the "cave-man" approach, but it works. I've estimated that a 7 character base 36 number could take up to 125 days (ouch!) to convert to base 10. A 5 character base 36 number could be converted in about 2 hours.

Brian

[ 09 June 2002, 12:55: Message edited by: BrianTX ]

Top
#66380 - 2002-06-09 06:15 AM Re: KiXtart Golf Tournament Part III !!!
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
So, are you guys are measuring the amount of code including your function/endfunction statements ? or just between these statements ? or the whole kit-and-kabootle, including the test call to the function ?

-Shawn

Top
#66381 - 2002-06-09 06:35 AM Re: KiXtart Golf Tournament Part III !!!
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
Right now everything. Since the request was for a Function, I would thing that the Function(...)/Endfunction should be included.
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#66382 - 2002-06-09 06:48 AM Re: KiXtart Golf Tournament Part III !!!
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
what if use external util?

with it I can make my code to 100 and speed to msecs!

well, then I should add also the prog...
979kB
heh...
_________________________
!

download KiXnet

Top
#66383 - 2002-06-09 08:04 AM Re: KiXtart Golf Tournament Part III !!!
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
Well, I'm finished. My product is a completely generic BaseConverter that works in either direction for base 2 through base 36.

KixGolf score = 591
code:
Function BaseConverter($value,$frombase,$tobase)
...
Endfunction

Time to solve the stated problem: 40 ticks
Time to resolve the inverse: 10 ticks

I am going to see if I can tighten up the code a little tomorrow.
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#66384 - 2002-06-09 10:40 AM Re: KiXtart Golf Tournament Part III !!!
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
this is cruel!

what more I get on to it, longer and more complex my script gets...

I started looking even from the web for the technologies, but as from other languages or from more complex brains the examples were no use to the countryboy.

but, howard, you can be sure that I'm taking every action it to takes to make you a competitor script.
maybe not in performance or style nor the length, but in clear syntax-style and thinking.
_________________________
!

download KiXnet

Top
#66385 - 2002-06-09 11:46 AM Re: KiXtart Golf Tournament Part III !!!
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
gave up with my current script.

it was nicely complex, but got so complex, it would have taken an army of geeks to complete.

taking coffee break after 5 hours of fighting and then will try again.
_________________________
!

download KiXnet

Top
#66386 - 2002-06-09 03:51 PM Re: KiXtart Golf Tournament Part III !!!
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11164
Loc: Boston, MA, USA
Guys:

I'm a little handicapped right now since my home computer is still pretty much dead, at least I got my Windows 98 partition working again to be able to surf the web and find solutions why the Win2K box logs me out right after accepting my login.

Anyway, I did do some testing on KiXtart 4.10RC2 before writing the challange and Kixtart seems to be able to handle large numbers if you convert to the CDBL() format of the number, which according to the manual is a double (= 8-byte double floating point, if I remember my C++ days correctly). Now, if the MOD() function indeed does not handle a large number, then a) we found a bug in KiXtart 4.10RC2 and b) there is a generic MOD() UDF on this board.

With regards to scoring the script, everything from $a=FUNCTION($b,$c,$d) up to and including ENDFUNCTION counts (except, of cource the comments, extraneous spaces and carriage return/linefeed characters).

I also believe that we will need a special assignment for Howard since he's beating everybody again. But, on the other hand, once he's posting his code on Monday afternoon EST, we can take it apart and see whether we can find ways for improvement.

Hint for writing the UDF: Start writing a standard UDF with understandable variable names before shortening everything by renaming variable names and concatenating multiple lines into one.

[ 09 June 2002, 15:53: Message edited by: sealeopard ]
_________________________
There are two types of vessels, submarines and targets.

Top
Page 1 of 5 12345>


Moderator:  Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, 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.073 seconds in which 0.025 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