Sealeopard
(KiX Master)
2002-06-08 04:40 PM
KiXtart Golf Tournament Part III !!!

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 ]


ShawnAdministrator
(KiX Supporter)
2002-06-08 09:52 PM
Re: KiXtart Golf Tournament Part III !!!

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 ...

Sealeopard
(KiX Master)
2002-06-08 10:21 PM
Re: KiXtart Golf Tournament Part III !!!

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.


Howard Bullock
(KiX Supporter)
2002-06-08 10:36 PM
Re: KiXtart Golf Tournament Part III !!!

Well guys, I think I have the logic, but am looking for a way to execute the large numbers.

Ahhh, maybe that will work...


ShawnAdministrator
(KiX Supporter)
2002-06-08 10:40 PM
Re: KiXtart Golf Tournament Part III !!!

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 ]


BrianTX
(Korg Regular)
2002-06-08 11:33 PM
Re: KiXtart Golf Tournament Part III !!!

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 ]


Les
(KiX Master)
2002-06-09 03:14 AM
Re: KiXtart Golf Tournament Part III !!!

Hmmm... Vartype not mentioned in the rules. One may infer an ascii (string) representation. A loophole maybe...

ShawnAdministrator
(KiX Supporter)
2002-06-09 03:58 AM
Re: KiXtart Golf Tournament Part III !!!

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 ]


BrianTX
(Korg Regular)
2002-06-09 04:14 AM
Re: KiXtart Golf Tournament Part III !!!

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 ]


Howard Bullock
(KiX Supporter)
2002-06-09 04:45 AM
Re: KiXtart Golf Tournament Part III !!!

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 ]


ShawnAdministrator
(KiX Supporter)
2002-06-09 04:47 AM
Re: KiXtart Golf Tournament Part III !!!

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 ]


Howard Bullock
(KiX Supporter)
2002-06-09 04:54 AM
Re: KiXtart Golf Tournament Part III !!!

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 ]


BrianTX
(Korg Regular)
2002-06-09 05:09 AM
Re: KiXtart Golf Tournament Part III !!!

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 ]


ShawnAdministrator
(KiX Supporter)
2002-06-09 06:15 AM
Re: KiXtart Golf Tournament Part III !!!

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


Howard Bullock
(KiX Supporter)
2002-06-09 06:35 AM
Re: KiXtart Golf Tournament Part III !!!

Right now everything. Since the request was for a Function, I would thing that the Function(...)/Endfunction should be included.

LonkeroAdministrator
(KiX Master Guru)
2002-06-09 06:48 AM
Re: KiXtart Golf Tournament Part III !!!

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...


Howard Bullock
(KiX Supporter)
2002-06-09 08:04 AM
Re: KiXtart Golf Tournament Part III !!!

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.


LonkeroAdministrator
(KiX Master Guru)
2002-06-09 10:40 AM
Re: KiXtart Golf Tournament Part III !!!

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.


LonkeroAdministrator
(KiX Master Guru)
2002-06-09 11:46 AM
Re: KiXtart Golf Tournament Part III !!!

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.


Sealeopard
(KiX Master)
2002-06-09 03:51 PM
Re: KiXtart Golf Tournament Part III !!!

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 ]


Howard Bullock
(KiX Supporter)
2002-06-09 04:13 PM
Re: KiXtart Golf Tournament Part III !!!

Jens, on the W2K issue. I have seen on NT4 the logout after logon caused by lack of permissions on the C:\winnt directory and subdirectories.

So we can shorten the variables and UDF name from what you specified in the rules?

Function BaseConverter($value,$frombase,$tobase)
...
Endfunction

To $f=a($b,$c,$d) ?


LonkeroAdministrator
(KiX Master Guru)
2002-06-09 05:00 PM
Re: KiXtart Golf Tournament Part III !!!

jens,
well...
If I'm awake at the time of posting-enabled, i'll post competitor for howard.

no any 4.10 functionality... as I'm using 4.02 but I'll make a working one anyway.

have been scratching my hair for so many hours that can't give up anymore...

as time being 1800 and last night spent at this, I'll probably go to bed now when 10 base to any imageable base part is finished.
the rest is just 2-3 lines away...

cheers,


Howard Bullock
(KiX Supporter)
2002-06-09 05:31 PM
Re: KiXtart Golf Tournament Part III !!!

I am still squashing some bugs that show themselves quite easily when converting to base2 using my approach. In case some one out there has implemented similiar functionality, I suggest that everyone verify proper functionality and result when BaseConverter("52",10,2) or BaseConverter("49",10,2).

[ 09 June 2002, 17:32: Message edited by: Howard Bullock ]


ShawnAdministrator
(KiX Supporter)
2002-06-09 06:00 PM
Re: KiXtart Golf Tournament Part III !!!

The Full Monty.

KixGolf score = 410

-Shawn


ShawnAdministrator
(KiX Supporter)
2002-06-09 06:28 PM
Re: KiXtart Golf Tournament Part III !!!

KixGolf score = 400

[ 09 June 2002, 18:37: Message edited by: Shawn ]


Howard Bullock
(KiX Supporter)
2002-06-09 06:46 PM
Re: KiXtart Golf Tournament Part III !!!

Darn: [Frown]

KixGolf score = 446


Howard Bullock
(KiX Supporter)
2002-06-09 07:35 PM
Re: KiXtart Golf Tournament Part III !!!

KixGolf score = 397 [Big Grin] [Razz]

{edit} [Mad] [Frown]
forgot the
code:
$=B($v,$d,$e)  

KixGolf score = 410 [Frown]

Tweak Tweak Tweak
KixGolf score = 381 [Big Grin]

[ 09 June 2002, 19:59: Message edited by: Howard Bullock ]


ShawnAdministrator
(KiX Supporter)
2002-06-09 08:29 PM
Re: KiXtart Golf Tournament Part III !!!

ah - ok - going to play rough are we ? [Wink]

plus - do you dim your local vars ?

1sec ... [Wink] [Big Grin]

Howard, whats this:

$=B($v,$d,$e)

is that what your using to call your function ? did you change the function protoype as well ?

HI DANA EDDY !!! GOOD TO SEE YOU ONLINE !!!

[ 09 June 2002, 20:33: Message edited by: Shawn ]


Howard Bullock
(KiX Supporter)
2002-06-09 08:37 PM
Re: KiXtart Golf Tournament Part III !!!

That is the function call. I shortened it based on Jens comments earlier. I explicitly ask him for a ruling on "$=B($v,$d,$e)" vs. "$result=BaseConverter($value,$frombase,$tobase)", but he has yet to respond. Until then I was going to be aggressive. [Wink]

He said that the function call had to be included.

I only Dim'ed what was necessary for my code to function - (0). Oh, I am giving away the farm here. [Smile]

[ 09 June 2002, 20:38: Message edited by: Howard Bullock ]


ShawnAdministrator
(KiX Supporter)
2002-06-09 08:48 PM
Re: KiXtart Golf Tournament Part III !!!

well, guess we should get a ruling on this [Wink] but personally, i think we should be allowed to shorten anything that isn't exposed to the UDF user, so this would be the minimum prototype:

function baseconverter($v,$f,$t)

and probably all $vars should be dimmed because they could possibly affect the user as well.

oh yeah, and maybe going forward, the puzzle should be phrased as:

? baseconverter($v,$f,$t)

instead of

$result = baseconverter($v,$f,$t)

that way, we don't have to keep commenting and deleting lines to get a KiXgolf count.

[ 09 June 2002, 21:11: Message edited by: Shawn ]


ShawnAdministrator
(KiX Supporter)
2002-06-09 09:07 PM
Re: KiXtart Golf Tournament Part III !!!

Based on the above discussion:

KixGolf score = 351 [Wink]

correction, forgot to put the quotes around the old and new base (in the call) [Frown]

[ 09 June 2002, 21:10: Message edited by: Shawn ]


Howard Bullock
(KiX Supporter)
2002-06-09 09:11 PM
Re: KiXtart Golf Tournament Part III !!!

Crap [Frown]

{edit}
KixGolf score = 341 [Wink]

[ 09 June 2002, 21:53: Message edited by: Howard Bullock ]


ShawnAdministrator
(KiX Supporter)
2002-06-09 10:07 PM
Re: KiXtart Golf Tournament Part III !!!

KixGolf score = 337

its a mad house ! a maaaaaaad hoooooowse !!!!

[Wink]

its getting hard for me to understand my own udf [Smile]

[ 09 June 2002, 22:09: Message edited by: Shawn ]


Howard Bullock
(KiX Supporter)
2002-06-09 10:11 PM
Re: KiXtart Golf Tournament Part III !!!

My daughter wants to go to the pool. How is that going to happen if you keep cutting stroke off your score?

ShawnAdministrator
(KiX Supporter)
2002-06-09 10:16 PM
Re: KiXtart Golf Tournament Part III !!!

LOL - Im trying to clean my pool - and my wife keeps yelling at me because I keep running down to the basement to check your score - ROFLMAO

ShawnAdministrator
(KiX Supporter)
2002-06-09 10:34 PM
Re: KiXtart Golf Tournament Part III !!!

KixGolf score = 331

BrianTX
(Korg Regular)
2002-06-09 11:03 PM
Re: KiXtart Golf Tournament Part III !!!

KixGolf score = 293

Not including calling the function.. but includes all parts of the function! (THIS ONE WORKS, BABY!... fast, too!) (hmm. add 40 to get the test function given... but I don't think it should count.

Brian

{edit}
make that 289.. (hmm. i suppose it's bad code not to initialize variables?) Maybe still 293.. lol

{edit again}
make that 287... I don't think I can trim much more out of this, though.

{edit again}
ok.. make that 278... although I'm pretty positive with this method I can't get it any smaller..

[ 09 June 2002, 23:17: Message edited by: BrianTX ]


Sealeopard
(KiX Master)
2002-06-09 11:10 PM
Re: KiXtart Golf Tournament Part III !!!

Okay guys, I'm going to comment on the function call issue:
code:
$result=BaseConverter('44680832201','10','36')

is the function call to the UDF. Therefore I expect the function itself to be in this form in order to get the lowest score:
code:
FUNCTION BaseConverter($b,$c,$d)
;the code itself
ENDFUNCTION

To be fair, we should keep the function name itself as BaseConverter. With regards to the DIM issues, since KiXtart does not require to DIM a variable (according to the manual), you don't need to do it either, unless it would cause problems inside your code.

And, BTW, the call to the function does not count, just the function itself (FUNCTION to ENDFUNCTION). Oh, and if you're using another UDF that is called by your main UDF, that one of course counts too. Just in case somebody wrote a custom MOD() or POWER() UDF.

Finally, the BaseConverter doesn't need to work for fractional numbers, just integers. BrianTX, you asked for clarification [Wink]


ShawnAdministrator
(KiX Supporter)
2002-06-09 11:11 PM
Re: KiXtart Golf Tournament Part III !!!

Brian, very nice ...

KixGolf score = 292

not including the call, and the prototype like this:

function baseconverter($n,$f,$t)

and to be honest, I don't think I can squeeze any more out of this puppy !!!

[ 09 June 2002, 23:13: Message edited by: Shawn ]


BrianTX
(Korg Regular)
2002-06-09 11:21 PM
Re: KiXtart Golf Tournament Part III !!!

I found a slight bug in formatting.. fiddling with it.. may actually cut more code... or not! lol

Brian

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


BrianTX
(Korg Regular)
2002-06-09 11:29 PM
Re: KiXtart Golf Tournament Part III !!!

Ok.. bug fixed...

Final score (I think):

270!!!

I wish I could post my code now.. I'm at home and I'll be at work tomorrow.. (I hate messing with diskettes..)

Brian


ShawnAdministrator
(KiX Supporter)
2002-06-09 11:37 PM
Re: KiXtart Golf Tournament Part III !!!

Cripes - I wish YOU could post YOUR script too ! Can't wait to see it. There is no way I'm going to shave 20+ strokes off mine any time soon, so its all up to Howard now, or maybe someone else is lurking in the background (hee-hee-hawwww) ...

I must gracefully concede

[ 09 June 2002, 23:38: Message edited by: Shawn ]


Howard Bullock
(KiX Supporter)
2002-06-10 12:00 AM
Re: KiXtart Golf Tournament Part III !!!

I might just have to go back to the drawing board. With the required name, I'm at 355. [Frown]

BrianTX
(Korg Regular)
2002-06-10 12:00 AM
Re: KiXtart Golf Tournament Part III !!!

Don't concede just yet.. just for the heck of it i tried some other numbers.... i found it isn't accurate 100% because the FIX function in 4.10rc2 doesn't work quite right... so now I'm fiddling with it again.

Brian


ShawnAdministrator
(KiX Supporter)
2002-06-10 12:03 AM
Re: KiXtart Golf Tournament Part III !!!

Well, Im using the fix() function too, so maybe mine isn't working 100% either, but I did try a few conversions ...

Can you provide sopme examples and some answers, so that we all can try ?

question guys, can any of your routines handle base's bigger than 36 ?

[ 10 June 2002, 00:04: Message edited by: Shawn ]


BrianTX
(Korg Regular)
2002-06-10 12:15 AM
Re: KiXtart Golf Tournament Part III !!!

Hmm. this is weird.. I can get it so things seem to work for some conversions but not others. I don't know what the deal is with that, but I'm still working on it.

Brian


BrianTX
(Korg Regular)
2002-06-10 12:37 AM
Re: KiXtart Golf Tournament Part III !!!

Okay.. it seems to be working correctly now.

Once I realized that FIX, INT, and RND don't work well for double floating point numbers, I figured it out... but.. now my score is.....

267!!! (If I remove the variable declaration I MAY not need, it's 263)

Brian

{edit}
Mine has no debugging code, so it won't know if you're entering invalid numbers.. I didn't see it as a requirement.. should it be?

[ 10 June 2002, 00:41: Message edited by: BrianTX ]


BrianTX
(Korg Regular)
2002-06-10 12:52 AM
Re: KiXtart Golf Tournament Part III !!!

Ok.. here are some values returned.. so anyone can check and see if theirs matches (or if they are correct)

code:
BaseConverter("35","10","3") ?
BaseConverter("78","11","13") ?
BaseConverter("2","3","2") ?
BaseConverter("23423","5","12") ?
BaseConverter("BrianTX","36","10")

Result:
1022
67
10
100A
25607922981
-----

This is with the score of 267.

Brian


ShawnAdministrator
(KiX Supporter)
2002-06-10 01:20 AM
Re: KiXtart Golf Tournament Part III !!!

ah crap - my base 36->10 broke - and it can't get up [Frown]

Howard Bullock
(KiX Supporter)
2002-06-10 01:45 AM
Re: KiXtart Golf Tournament Part III !!!

Brian, mine match. but I can't seem to get lower than 309.

Verify that your base 2 works:

BaseConverter("64","8","2") = 110100
BaseConverter("52","10","2") = 110100


BrianTX
(Korg Regular)
2002-06-10 01:47 AM
Re: KiXtart Golf Tournament Part III !!!

Just out of curiosity, I tested how large of numbers the script can handle....

Base 36 - 10 long
Base 10 - 15 long
Base 2 - 50 long

Brian

P.S.... Are you participating or judging, sealeopard? Would you like to see my code?


BrianTX
(Korg Regular)
2002-06-10 01:49 AM
Re: KiXtart Golf Tournament Part III !!!

Do you do any sort of error checking? If I was going to publish this UDF, I'd probably check to make sure the inputs were valid, but I did no such checking on this one.

Brian


Howard Bullock
(KiX Supporter)
2002-06-10 01:54 AM
Re: KiXtart Golf Tournament Part III !!!

At 267 I sure hope there is no error checking. Otherwise, I'm a really bad coder.

No proper UDF would be constructed under these rules.

[ 10 June 2002, 01:55: Message edited by: Howard Bullock ]


BrianTX
(Korg Regular)
2002-06-10 01:59 AM
Re: KiXtart Golf Tournament Part III !!!

I shaved off a bit more.. Now I'm at 261...

Brian


Howard Bullock
(KiX Supporter)
2002-06-10 02:06 AM
Re: KiXtart Golf Tournament Part III !!!

I can't wait to see this code! [Cool]

Howard Bullock
(KiX Supporter)
2002-06-10 02:14 AM
Re: KiXtart Golf Tournament Part III !!!

Hey if I don't count my Function/Endfunction lines I'm at 267. Brian, you are counting those aren't you?

[ 10 June 2002, 02:15: Message edited by: Howard Bullock ]


BrianTX
(Korg Regular)
2002-06-10 02:21 AM
Re: KiXtart Golf Tournament Part III !!!

Hmm. without the Function/EndFunction lines I get 219. With them I get 261.

I seriously doubt my code can be further optimized..... so I'm about to quit.. good luck guys! [Smile]

Brian


Sealeopard
(KiX Master)
2002-06-10 02:55 AM
Re: KiXtart Golf Tournament Part III !!!

Brian:

I will be participating if I can find some quiet time at work. I'm still repairing my home computer which now insists on using drive letter I: as the system drive (no other partitions active).

I already have an idea for the code myself, so I do have to decline to see your code. But I am already looking forward to tomorrow afternoon whne everybody is allowed to post code. I am very curious about the different methods everybody is using.

Also, I have to say, I am very impressed by the participation, I already told my wife that I created a monster. She has read the whole thread and would love to give it a shot too, but she doesn't know KiXtart (she's taking C++ programming classes, though).


BrianTX
(Korg Regular)
2002-06-10 03:10 AM
Re: KiXtart Golf Tournament Part III !!!

It's been fun, Jens!

I really don't think I can squeeze my code down any more.

How many hours does everyone have to beat 261 ?

Something like 12?

Brian


Sealeopard
(KiX Master)
2002-06-10 03:22 AM
Re: KiXtart Golf Tournament Part III !!!

Brian:

There are still 18 hours left before the code gets posted. I also expect that some people might join the fray tomorrow morning when they come to work. Not everybody is checking the BBS on weekends.

Another thought that came to mind. Since nearly everybody experimented with KiXtart 4.10RC2 could you please be so nice and report the problems with floating point math (FIX, INT, RND) in the beta forum if you necountered any. I think Ruud will be delighted to hear about our little coding frenzy and the potentially new bugs.


BrianTX
(Korg Regular)
2002-06-10 03:24 AM
Re: KiXtart Golf Tournament Part III !!!

I don't know if they are bugs or not.. I mean.. must the INT, FIX, MOD work for numbers of type CDBL? ... I think ROUND works, but I wouldn't stake my life on it. The CINT is designed to even out error due to .5 calculations. I assumed that the other types were put in to support external objects and methods, but not necessarily designed to do actual calculations in KiXtart. I could be wrong, however. I noticed there was support for the type "long integer" but it's these are types that may not work the same way as the standard types.
(I will go ahead and post something, though)

Brian

[ 10 June 2002, 16:19: Message edited by: BrianTX ]


Howard Bullock
(KiX Supporter)
2002-06-10 05:58 AM
Re: KiXtart Golf Tournament Part III !!!

KixGolf score = 283

I think I am about at the end of my rope here. Can't see much more improvement being squeezed out of this script.

[ 10 June 2002, 05:59: Message edited by: Howard Bullock ]


BrianTX
(Korg Regular)
2002-06-10 06:06 AM
Re: KiXtart Golf Tournament Part III !!!

Hmm. ya know.. if you get it down to 261, I will assume you have (near) identical code to mine with the variables changed. lol

Brian


Howard Bullock
(KiX Supporter)
2002-06-10 07:19 AM
Re: KiXtart Golf Tournament Part III !!!

KixGolf score = 253 [Big Grin]

I think it is legal. [Wink]


LonkeroAdministrator
(KiX Master Guru)
2002-06-10 07:25 AM
Re: KiXtart Golf Tournament Part III !!!

just to help you test your code, check this out
http://www.jimwillsher.co.uk/Site/Software/BCU_Intro.html

I've been using it and it has broven my script functioning.

cheers,


BrianTX
(Korg Regular)
2002-06-10 01:55 PM
Re: KiXtart Golf Tournament Part III !!!

Hmm. you got it to 253, Howard? hmm. I may have to revisit mine again... lol.. I think it's done, though.

Brian

{Edit} If I don't initialize my variables, I can get mine to 252 ... But it only works if:

#1 you're not using a specific variable before calling the function...

#2 you're not calling the function twice.
..... If that's what you're doing, I think it's best to initialize the variables... If I can break your code by having certain variables preexisting, then I don't think it's valid code... Just my 2 cents.

[ 10 June 2002, 14:10: Message edited by: BrianTX ]


Howard Bullock
(KiX Supporter)
2002-06-10 02:25 PM
Re: KiXtart Golf Tournament Part III !!!

Well this is where I'm torn. The task was not to develop practical for use in someone application but to provide the output required for a specific input. In this sense, I think the result you describe is valid for KixGolf. Naturely these items and other safe guards would have to be inplemented for more bullet proof code used publicly.

Now for real question, if you are retuning the result back through the $BaseConverter name, then I'm toast and have to conceed. If we only have to get the answer to the screen then, I'm right there nipping at your heels.


BrianTX
(Korg Regular)
2002-06-10 02:27 PM
Re: KiXtart Golf Tournament Part III !!!

I'm getting 261 through the baseconverter name... and 253 through the baseconverter name if I assume that it's a script by itself (needs no variables initialized that are 0 or nul.)

Brian


Howard Bullock
(KiX Supporter)
2002-06-10 02:31 PM
Re: KiXtart Golf Tournament Part III !!!

Crap. [Wink]

Well I have to conceed then. My best is 278 returning the answer throught $BaseConverter.

Execellent job Brian!!


ShawnAdministrator
(KiX Supporter)
2002-06-10 02:37 PM
Re: KiXtart Golf Tournament Part III !!!

yap - and my base 10 to base N routine is on the operating table ... plus, I would have had a tough time shaving down to where you guys are anyways ... unless one of you want to be a sport and donate one of your algorithms [Wink]

BrianTX
(Korg Regular)
2002-06-10 03:00 PM
Re: KiXtart Golf Tournament Part III !!!

I'm going to call it 261.... It includes creating the function and everything between:

code:
Function BaseConverter($v,$f,$t)
.
.
.
EndFunction

The clarification from Jens was that it be JUST the function, including the Function/Endfunction lines.

Brian

P.S. Jens, you said it was supposed to last 48 hours.. according to my calculations, 48 hours from your posting time would be in 1.5 hours, even though you said 3 PM EST... I guess I have an itchy trigger finger!!! lol... another thought.. if you want to set the end time, would it be wise to create a NEW topic for posting when the time is up? I mean... this one is getting pretty LONG!!!

[ 10 June 2002, 15:08: Message edited by: BrianTX ]


ShawnAdministrator
(KiX Supporter)
2002-06-10 03:09 PM
Re: KiXtart Golf Tournament Part III !!!

imho, i think all local variables should have to be dimmed locally. if they are not - the UDF really isn't self-contained - plus lets face it, Brians UDF will probably go straight into the UDF library - this is one of the happy side-effects of playing a game like this.

just food for thought. no biggy


BrianTX
(Korg Regular)
2002-06-10 03:15 PM
Re: KiXtart Golf Tournament Part III !!!

Actually, before it would go into the UDF library (according to coding conventions), it might be wise to check inputs. I mean... only letters and numbers should be allowed, and all the numerals in a base x number should be less than x, and the bases should be between 2 and 36... Otherwise, if someone passes invalid data it could cause their script to stop completely.

Someone else can add that stuff to my script if they want! lol

Brian


BrianTX
(Korg Regular)
2002-06-10 04:38 PM
Re: KiXtart Golf Tournament Part III !!!

Another question, Jens, since we are at the 48 hour mark (although not at your set deadline)... Can we assume capital letters A-Z? Or do we have to allow for lowercase letters as well? If we just use caps, i can shorten the code some more{by UCASE()}... to 254..

Also, is it 3 PM EST or EDT? (daylight time)

Brian


Sealeopard
(KiX Master)
2002-06-10 05:34 PM
Re: KiXtart Golf Tournament Part III !!!

I believe the UDF should return the correct base conversion even if the input is for example '12a' instead of '12A', meaning both inputs should be treated the same. AFAIK, there is no standard as to whether e.g hexadecimal bases have to be in caps or non-caps

As for the closing date/time, it is 3pm Eastern Daylight Savings Time wich equals 9pm (21:00) Kixtart board time.

I will start a new thread at the assigned time for the code-postings. Just make sure to not have long lines in your post.

[ 10 June 2002, 17:35: Message edited by: sealeopard ]


BrianTX
(Korg Regular)
2002-06-10 09:01 PM
Re: KiXtart Golf Tournament Part III !!!

It's time.. where is the new topic? lol

Brian


LonkeroAdministrator
(KiX Master Guru)
2002-06-10 09:10 PM
Re: KiXtart Golf Tournament Part III !!!

so..
where is it????
don't see no kixgolf results...


BrianTX
(Korg Regular)
2002-06-10 09:11 PM
Re: KiXtart Golf Tournament Part III !!!

Jens said he'd post a new topic... that we could post code on.. so i'm waiting for that.

Brian


BrianTX
(Korg Regular)
2002-06-10 09:21 PM
Re: KiXtart Golf Tournament Part III !!!

Hmm. Jens.. are you ok, bud? Should we go ahead and post our solutions?

Brian


Howard Bullock
(KiX Supporter)
2002-06-10 09:22 PM
Re: KiXtart Golf Tournament Part III !!!

Wow! I was stuck in a corporate meeting and thought I missed all the action. thanks for waiting for me!

BrianTX
(Korg Regular)
2002-06-10 09:24 PM
Re: KiXtart Golf Tournament Part III !!!

Sure.. should i go ahead and create a new topic and post solutions? Or wait for Jens? I hate to be rude!

Brian


ShawnAdministrator
(KiX Supporter)
2002-06-10 09:25 PM
Re: KiXtart Golf Tournament Part III !!!

I'm sitting here with one foot out the door to catch a commuter train - and I want to see everyone's solution for the long read home ...

BrianTX
(Korg Regular)
2002-06-10 09:26 PM
Re: KiXtart Golf Tournament Part III !!!

Ok.. if you don't speak up i'm gonna post, Jens!

[Razz]

Brian


LonkeroAdministrator
(KiX Master Guru)
2002-06-10 09:28 PM
Re: KiXtart Golf Tournament Part III !!!

mm...
my script is working pretty well from 10 base to any base (usable from base 2 upto base 20000 approx.)

but to other direction I'm scratchin my head.
the string manipulation goes so weird, when has to count together strings with values of 50 digits.
mm...
I could do this easier, but I know you are ahead with this, so I give the competition and just try to make code that is backwards compatible up to even 3.5*/3.6*

have to see...

will post my code even if I can't finish it in next 2 hours.

cheers,


Sealeopard
(KiX Master)
2002-06-10 09:37 PM
Re: KiXtart Golf Tournament Part III !!!

Round 2 of the KiXtart Golf Tournament has been posted!