Page 1 of 13 12345>Last »
Topic Options
#164279 - 2006-07-15 01:57 PM KiXgolf: Mayan Number Converter
Sealeopard Offline
KiX Master
*****

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


You are to create a Mayan Number Converter that converts a Mayan number into a decimal and vice versa.

The input is a Mayan number, with digits composed by following elements (given in order of appearance):

  • a period (.) represents one stone,
  • a colon (:) represents two stones,
  • a pipe character (|) represents a stick (five stones), and
  • a hyphen (-) represents the null seashell.


Mayan digits are separated by spaces, and there will be from 1 to 7 digits.

Example:

.:| .:||| ::| ::|| .

The corresponding Output should be the integer equivalent, in this case:

1427881

calculated as follows:

20^4*(3+5) + 20^3*(3+15) + 20^2*(4+5) + 20^1*(4+10) + 20^0*(1)
= 1280000 + 144000 + 3600 + 280 + 1
= 1427881

Analogous, if the input is an integer number, then the output should generate the corresponding Mayan number.

Thus, an input of 1427881 should result in an output of ".:| .:||| ::| ::|| ."

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


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


The input is either a string containing a Mayan number as described above or an integer that can be converted into a Mayan Number.

The output is the corresponding integer representing the Mayan number or a string containing the Mayan Number representation of the input integer.


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


All provided test cases representing valid Mayan Numbers must be correctly solved in order to have the KiXgolf score count. However, if a script fails any valid public or non-public test case the KiXgolf score will not count.


=============
General rules
=============


  • The UDF must be written as one or more lines.
  • The UDF is expected to finish in a reasonable time, e.g. if it gets started when the challenge opens, it's expected to be finished by the time the challenge closes even on a somewhat slow computer. The UDF has to be valid during the period that the challenge runs.
  • You can submit scores as often as you want until the deadline, there's no reason to wait until the last minute for a score submission. In fact, other people want to see the score to beat. So don't be a spoilsport by hoarding your score. Submit early and often.
  • The UDF may only use the KiXtart/KiXforms commands/functions/macros, no other code fragments are allowed. Calls to cOM components that are part part of a standard default Windows installation are allowed.
  • Calls to other executables, as long as they are part of a standard default Windows installation are allowed.
  • The use of the KiXforms DLL is also permitted as the KiXforms DLL can now be considered an integral part of KiXtart scripting.
  • 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.
  • You may assume ASCII as character set.
  • You may not use block comments as the KiXgolf Scoring Engine does not support block comments
  • You are not allowed to use additional code that is external to the KiXgolf UDF Collection. All code must be contained within the KiXgolf UDF Collection.
  • You are allowed to only use publicly available versions of KiXtart and KiXforms, private builds or alpha builds are NOT allowed
  • Your submitted score must include the KiXart/KiXforms version used.

When posting KiXtart Golf Scores, please include the KIXGOLF_MNC.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.

========
Deadlines
========


Private coding starts Saturday, July 15, 8am EST
Private coding ends Saturday, July 22, 8am EST
Public coding start Saturday, July 22, 8am EST
Public coding ends Sunday, July 30, 10pm EST


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


A test program is provided to help screen entries and to provide the Golf Score.
Any program that passes the test program can be submitted. If you are surprised that your solution passed the test program, 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 is syntactically correct with KiXtart.
4) The final solution MUST pass all test scripts that accompagny the KiXtart golf challenge.
5) The use of '$' as a variable is allowed.
6) In case of questions about a particular way to count the KiXtart Golf Challenge organizer has the last call.
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


You will need the complete package from http://s91376351.onlinehome.us/kixtart/kixgolf_mnc.zip .


Edited by sealeopard (2006-07-15 02:30 PM)
_________________________
There are two types of vessels, submarines and targets.

Top
#164280 - 2006-07-15 02:13 PM Re: KiXgolf: Mayan Number Converter
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
I'm missing something.
where do the "20^" come from?
what are the actual calculating rules for mayan numerology???

are we supposed to find out them ourselfes?
as in reverse engineer the math?
_________________________
!

download KiXnet

Top
#164281 - 2006-07-15 02:22 PM Re: KiXgolf: Mayan Number Converter
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11164
Loc: Boston, MA, USA
Did you go through the example? There's nothing to reverse engineer. The example clearly demonstrates the conversion process from a Mayan Number to decimal and vice versa.
_________________________
There are two types of vessels, submarines and targets.

Top
#164282 - 2006-07-15 02:23 PM Re: KiXgolf: Mayan Number Converter
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
Hey Jens, I was just "setting-up" for this and noticed that this solution:

Code:

Function m($)

$m = 0

EndFunction



Produced a 51% passed percentage ... should that be ?

-Shawn

Top
#164283 - 2006-07-15 02:28 PM Re: KiXgolf: Mayan Number Converter
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
WOW! More than half way there already.

Jens,
Edit your post replacing uppercase code tags with lowercase ones.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#164284 - 2006-07-15 02:31 PM Re: KiXgolf: Mayan Number Converter
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
It seems like if you return a zero when you should be returning a string, it passes - thats all.
Top
#164285 - 2006-07-15 02:37 PM Re: KiXgolf: Mayan Number Converter
Sealeopard Offline
KiX Master
*****

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

Yes, that shouldn't happen. Fixed the validation code.

Les:

Didn't know about the upper/lower-case difference, fixed the post.

I've updated the package, specifically the kixgolf_mnc.kix main script, to now correctly evaluate the results without potentially converting strings to integers and vice versa.

Please get the updated script at http://s91376351.onlinehome.us/kixtart/kixgolf_mnc.zip
_________________________
There are two types of vessels, submarines and targets.

Top
#164286 - 2006-07-15 02:40 PM Re: KiXgolf: Mayan Number Converter
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
jens, yes I did read it.
but as it lacked the real rules, I had to indeed study the math.

anyways, I have mayan to decimal converter now. and it was the easy part.
with a score of 435.
_________________________
!

download KiXnet

Top
#164287 - 2006-07-15 03:00 PM Re: KiXgolf: Mayan Number Converter
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
hmm...
thought I had it there, but the score engine says otherwise
_________________________
!

download KiXnet

Top
#164288 - 2006-07-15 03:19 PM got it
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
Code:

Mayan Number Converter passed all 60 tests (100% correct)

KiXtart
KiXtart Version = 4.52 Release Candidate 1
KiXGolf Script = kixgolf_mnc.kix

Computer
OS = Windows XP Professional
CPU = Intel Pentium Model 13
Speed = 1866 MHz
Memory = 760 MB

KiXGolf Scoring Engine
Scoring Engine = 3.0.3

KiXtart Golf Score
Tournament = KiXtart Golf: Mayan Number Converter
Processing Start = 2006/07/15 16:18:50.125
Processing End = 2006/07/15 16:18:50.156
Duration = 0000/00/00 00:00:00.031
KiXGolf Score = 608

Thank you for participating in KiXtart Golf!
Press any key to continue...

_________________________
!

download KiXnet

Top
#164289 - 2006-07-15 03:24 PM Re: got it
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
jens, the validation code should be also fixed to output not "[/CODE]" but the lower case version.

anyways.
Code:

Mayan Number Converter passed all 60 tests (100% correct)

KiXtart
KiXtart Version = 4.52 Release Candidate 1
KiXGolf Script = kixgolf_mnc.kix

Computer
OS = Windows XP Professional
CPU = Intel Pentium Model 13
Speed = 1866 MHz
Memory = 760 MB

KiXGolf Scoring Engine
Scoring Engine = 3.0.3

KiXtart Golf Score
Tournament = KiXtart Golf: Mayan Number Converter
Processing Start = 2006/07/15 16:23:00.812
Processing End = 2006/07/15 16:23:00.828
Duration = 0000/00/00 00:00:00.016
KiXGolf Score = 384


Top
#164290 - 2006-07-15 03:34 PM Re: got it
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
Mayan Number Converter passed all 60 tests (100% correct)

KiXtart
KiXtart Version = 4.52 Release Candidate 2
KiXGolf Script = kixgolf_mnc.KIX

Computer
OS = Windows XP Professional
CPU = Intel Pentium Model 9
Speed = 1398 MHz
Memory = 512 MB

KiXGolf Scoring Engine
Scoring Engine = 3.0.3

KiXtart Golf Score
Tournament = KiXtart Golf: Mayan Number Converter
Processing Start = 2006/07/15 09:34:49.517
Processing End = 2006/07/15 09:34:49.538
Duration = 0000/00/00 00:00:00.021
KiXGolf Score = 499

Thank you for participating in KiXtart Golf!

Top
#164291 - 2006-07-15 03:34 PM Re: got it
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11164
Loc: Boston, MA, USA
Fixed in both the current ZIP package and for the future tournaments as well.
_________________________
There are two types of vessels, submarines and targets.

Top
#164292 - 2006-07-15 03:42 PM mayan calculator - private results...
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
nice to see you are shawn in the game.

Code:

Mayan Number Converter passed all 60 tests (100% correct)

KiXtart
KiXtart Version = 4.52 Release Candidate 1
KiXGolf Script = kixgolf_mnc.kix

Computer
OS = Windows XP Professional
CPU = Intel Pentium Model 13
Speed = 1866 MHz
Memory = 760 MB

KiXGolf Scoring Engine
Scoring Engine = 3.0.3

KiXtart Golf Score
Tournament = KiXtart Golf: Mayan Number Converter
Processing Start = 2006/07/15 16:41:41.609
Processing End = 2006/07/15 16:41:41.640
Duration = 0000/00/00 00:00:00.031
KiXGolf Score = 340


Top
#164293 - 2006-07-15 03:53 PM Re: mayan calculator - private results...
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
Code:

Mayan Number Converter passed all 60 tests (100% correct)

KiXtart
KiXtart Version = 4.52 Release Candidate 1
KiXGolf Script = kixgolf_mnc.kix

Computer
OS = Windows XP Professional
CPU = Intel Pentium Model 13
Speed = 1866 MHz
Memory = 760 MB

KiXGolf Scoring Engine
Scoring Engine = 3.0.3

KiXtart Golf Score
Tournament = KiXtart Golf: Mayan Number Converter
Processing Start = 2006/07/15 16:53:08.390
Processing End = 2006/07/15 16:53:08.421
Duration = 0000/00/00 00:00:00.031
KiXGolf Score = 332


Top
#164294 - 2006-07-15 04:41 PM Re: mayan calculator - private results...
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
Mayan Number Converter passed all 60 tests (100% correct)

KiXtart
KiXtart Version = 4.52 Release Candidate 2
KiXGolf Script = kixgolf_mnc.KIX

Computer
OS = Windows XP Professional
CPU = Intel Pentium Model 9
Speed = 1398 MHz
Memory = 512 MB

KiXGolf Scoring Engine
Scoring Engine = 3.0.3

KiXtart Golf Score
Tournament = KiXtart Golf: Mayan Number Converter
Processing Start = 2006/07/15 10:41:25.513
Processing End = 2006/07/15 10:41:25.523
Duration = 0000/00/00 00:00:00.010
KiXGolf Score = 339

Thank you for participating in KiXtart Golf!

Top
#164295 - 2006-07-15 04:41 PM Re: mayan calculator - private results...
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
oh, you are getting closer...
good for you!

Top
#164296 - 2006-07-15 05:01 PM Re: mayan calculator - private results...
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
Mayan Number Converter passed all 60 tests (100% correct)

KiXtart
KiXtart Version = 4.52 Release Candidate 2
KiXGolf Script = kixgolf_mnc.KIX

Computer
OS = Windows XP Professional
CPU = Intel Pentium Model 9
Speed = 1398 MHz
Memory = 512 MB

KiXGolf Scoring Engine
Scoring Engine = 3.0.3

KiXtart Golf Score
Tournament = KiXtart Golf: Mayan Number Converter
Processing Start = 2006/07/15 11:01:23.726
Processing End = 2006/07/15 11:01:23.726
Duration = 0000/00/00 00:00:00.000
KiXGolf Score = 329

Thank you for participating in KiXtart Golf!

Top
#164297 - 2006-07-15 05:02 PM Re: mayan calculator - private results...
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
fine.
Code:

Mayan Number Converter passed all 60 tests (100% correct)

KiXtart
KiXtart Version = 4.52 Release Candidate 1
KiXGolf Script = kixgolf_mnc.kix

Computer
OS = Windows XP Professional
CPU = Intel Pentium Model 13
Speed = 1866 MHz
Memory = 760 MB

KiXGolf Scoring Engine
Scoring Engine = 3.0.3

KiXtart Golf Score
Tournament = KiXtart Golf: Mayan Number Converter
Processing Start = 2006/07/15 18:02:16.437
Processing End = 2006/07/15 18:02:16.468
Duration = 0000/00/00 00:00:00.031
KiXGolf Score = 306


Top
#164298 - 2006-07-15 05:05 PM Re: mayan calculator - private results...
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
but here is the results I was working on when you forced me to reply:
Code:

Mayan Number Converter passed all 60 tests (100% correct)

KiXtart
KiXtart Version = 4.52 Release Candidate 1
KiXGolf Script = kixgolf_mnc.kix

Computer
OS = Windows XP Professional
CPU = Intel Pentium Model 13
Speed = 1866 MHz
Memory = 760 MB

KiXGolf Scoring Engine
Scoring Engine = 3.0.3

KiXtart Golf Score
Tournament = KiXtart Golf: Mayan Number Converter
Processing Start = 2006/07/15 18:04:24.968
Processing End = 2006/07/15 18:04:24.984
Duration = 0000/00/00 00:00:00.015
KiXGolf Score = 293


Top
Page 1 of 13 12345>Last »


Moderator:  Arend_, Allen, Jochen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 628 anonymous users online.
Newest Members
Raoul, Timothy, Jojo67, MaikSimon, kvn317
17875 Registered Users

Generated in 0.095 seconds in which 0.041 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org