Page 1 of 10 12345>Last »
Topic Options
#178692 - 2007-08-04 01:26 AM KiXgolf: Top Secret
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11164
Loc: Boston, MA, USA
UPDATE 3:Clarified rules regarding characters and numbers, added a couple of test cases to package.

UPDATE 2:A "new" test case 2 has been included by popular demand.

UPDATE:Test case 2 has been removed from the package due to invalid test. Please either downlaod the new package or remove test case 2 from the .INI file.

=============
The Challenge: Top Secret
=============


A technique for encoding and decoding secret message is called cipher. The original message is called the plaintext, and the encoded message is called the ciphertext. One method for encoding message is transposition. The plaintext is first divided into blocks of equal length. We then choose a permutation to reorder the characters in each block. For example, if the block length is 5 and the permutation is 3 5 2 1 4 then the third character in each block becomes the first, the fifth becomes second, the second becomes third, the first becomes fourth and the fourth becomes fifth. Therefore, the message "Collegiate Programming Contest" is first divided into
 Code:
Colle|giate| Progr|ammin|g Cont|est
12345|12345| 12345|12345|1 2345|123

and then permuted into
 Code:
leoClaeigt orrPgmnmaio tCgntse

Note that blanks and punctuations are not counted in any block, and should be left in their original positions. Note that the last block should be handled differently if it does not contain the full length of characters. In the example, the last block is "est". Since it contains only 3 characters, we eliminate 4 and 5 from the permutation "3 5 2 1 4" and use "3 2 1" to reorder the last block and get "tse".

1 <= Blocksize <= 10
Characters are a-z and A-Z only, numbers and other "special" characters, punctuations, blanks,... are to be left in their original positions.

You are to write a function to implement this technique. The function will require four inputs:
1) the block length
2) the permutation
3) the message to be encoded or decoded
4) a parameter denoting encoding (E) or decoding (D)

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

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


Input: Blocklength, permutation, message, and code mode as outlined above

Output: Properly encoded or decoded message. Please note that the strings will be tested in case-sensitive mode.

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


1) Private coding phase: From date/time of posting the tournament challenge to EST (BBS+6 time)

2) Public coding phase: From EST (BBS+6 time) to EST (BBS+6 time)

3) Final results: EST (BBS+6 time)

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


Edited by Sealeopard (2007-08-09 06:20 AM)
_________________________
There are two types of vessels, submarines and targets.

Top
#178696 - 2007-08-04 09:12 AM Re: KiXgolf: Top Secret [Re: Sealeopard]
Jochen Administrator Offline
KiX Supporter
*****

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

great to see the tournament rolling \:\)

One observation: $sKiXGolfUDF is doubly defined in kixgolf_ts.kix, after deleting one of them it still dies on 'doubly defined udf' ... checking
_________________________



Top
#178697 - 2007-08-04 09:43 AM Re: KiXgolf: Top Secret [Re: Jochen]
Jochen Administrator Offline
KiX Supporter
*****

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

@scriptname translates to KIXGOL~1.KIX which is splitjoined to KIXGOL~1.UDF
which lets the script trying to call kixgolf3.3.udf AGAIN!

Is it just my system or does anyone else suffer from short filename translation?
_________________________



Top
#178698 - 2007-08-04 01:43 PM Re: KiXgolf: Top Secret [Re: Jochen]
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11164
Loc: Boston, MA, USA
Maybe your system? Script never complained to me about the double-defined variable or UDF. Also, cannot reproduce the tilde issue. What version KiXtart are you using?

I removed the second variable definition and uploaded the corrected package.


Edited by Sealeopard (2007-08-04 01:44 PM)
_________________________
There are two types of vessels, submarines and targets.

Top
#178699 - 2007-08-04 03:07 PM Re: KiXgolf: Top Secret [Re: Sealeopard]
Allen Administrator Online   shocked
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4549
Loc: USA
 Quote:
Note that blanks and punctuations are not counted in any block


Punctuations.... Are we talking about anything outside of the alphabet, or just the comma and period?

Top
#178700 - 2007-08-04 03:10 PM Re: KiXgolf: Top Secret [Re: Allen]
Allen Administrator Online   shocked
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4549
Loc: USA
and WOW... I thought someone would have a working score by now. Who's playing so far?
Top
#178703 - 2007-08-04 03:46 PM Re: KiXgolf: Top Secret [Re: Allen]
Allen Administrator Online   shocked
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4549
Loc: USA
 Quote:

1) the block length
2) the permutation


Would there ever be a time where #1 could not be determined from #2?

Top
#178705 - 2007-08-04 05:36 PM Re: KiXgolf: Top Secret [Re: Sealeopard]
Jochen Administrator Offline
KiX Supporter
*****

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

Found the UltraEdit Tools thing to be the cause. No problems running it from the command line. Maybe the UltraEdit Dos Command Window is a bit different.
Funny that I never faced that problem before, running my scripts out of UE since ages \:o


btw, haven't really started to code, as it's weekend ;\) ... and it's not that trivial, at least for me


Edited by Jochen (2007-08-04 06:00 PM)
_________________________



Top
#178706 - 2007-08-04 07:03 PM Re: KiXgolf: Top Secret [Re: Jochen]
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11164
Loc: Boston, MA, USA
Yes, I would say you can assume that the block length would not be longer than the permutation. But the block length could be shorter than the permutation, as shown in the example.
_________________________
There are two types of vessels, submarines and targets.

Top
#178707 - 2007-08-04 08:23 PM Re: KiXgolf: Top Secret [Re: Sealeopard]
Allen Administrator Online   shocked
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4549
Loc: USA
Right... I just meant it seems kind of redundant to have an input that can be obtained from counting the elements of the perm.

Did you see my other question about the punctuation?

Top
#178708 - 2007-08-04 09:35 PM Re: KiXgolf: Top Secret [Re: Allen]
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11164
Loc: Boston, MA, USA
Anything that is not a letter or number would fall under the "punctuation" category.
_________________________
There are two types of vessels, submarines and targets.

Top
#178715 - 2007-08-05 07:42 PM Re: KiXgolf: Top Secret [Re: Sealeopard]
Jochen Administrator Offline
KiX Supporter
*****

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

I think you have to review the test case #2.

IMO encoding "leoClaeigt orrPgmnmaio tCgntse" with a permutation of 3,5,2,1,4 results not in "Collegiate Programming Contest",but in "olelCiteag rgroPminmaC ntogest"
_________________________



Top
#178717 - 2007-08-06 01:27 AM Re: KiXgolf: Top Secret [Re: Jochen]
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11164
Loc: Boston, MA, USA
Jochen: You're correct. Test case 2 is invalid. I'm removing test case 2 from the package. Sorry for that, happens when you start modifying the test cases without fully testing them.
_________________________
There are two types of vessels, submarines and targets.

Top
#178718 - 2007-08-06 05:55 AM Re: KiXgolf: Top Secret [Re: Sealeopard]
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
I just realized that test case #2 was invalid as well. I wish I had refreshed my page sooner. Well I am half way there. All the encoding works.
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#178719 - 2007-08-06 06:53 AM Re: KiXgolf: Top Secret [Re: Howard Bullock]
Jochen Administrator Offline
KiX Supporter
*****

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

me too, well, except for two escape characters in a row, and already have a score of 468 \:\(
_________________________



Top
#178726 - 2007-08-06 03:10 PM Re: KiXgolf: Top Secret [Re: Jochen]
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
WAAAAHAHAHAHAH ... hah ... haha ... err .. My brain hurts

 Quote:

Running Test 1 Encoding...Decoding...Done
Running Test 3 Encoding...Decoding...Done
Running Test 4 Encoding...Decoding...Done
Your solution passed all tests

KiXtart
KiXtart Version = 4.53
KiXGolf Script = kixgolf_ts.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 = Top Secret
Processing Start = 2007/08/06 15:06:04.828
Processing End = 2007/08/06 15:06:04.828
Duration = 0000/00/00 00:00:00.000
KiXGolf Score = 593

Thank you for participating in KiXtart Golf!
_________________________



Top
#178727 - 2007-08-06 04:16 PM Re: KiXgolf: Top Secret [Re: Jochen]
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
Let's get it on!

 Quote:

Running Test 1 Encoding...Decoding...Done
Running Test 3 Encoding...Decoding...Done
Running Test 4 Encoding...Decoding...Done
Your solution passed all tests

KiXtart
KiXtart Version = 4.53
KiXGolf Script = kixgolf_ts.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 = Top Secret
Processing Start = 2007/08/06 16:15:12.921
Processing End = 2007/08/06 16:15:12.937
Duration = 0000/00/00 00:00:00.015
KiXGolf Score = 584

Thank you for participating in KiXtart Golf!
_________________________



Top
#178728 - 2007-08-06 04:38 PM Re: KiXgolf: Top Secret [Re: Jochen]
Jochen Administrator Offline
KiX Supporter
*****

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

 Quote:

Running Test 1 Encoding...Decoding...Done
Running Test 3 Encoding...Decoding...Done
Running Test 4 Encoding...Decoding...Done
Your solution passed all tests

KiXtart
KiXtart Version = 4.53
KiXGolf Script = kixgolf_ts.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 = Top Secret
Processing Start = 2007/08/06 16:37:45.656
Processing End = 2007/08/06 16:37:45.671
Duration = 0000/00/00 00:00:00.014
KiXGolf Score = 582

Thank you for participating in KiXtart Golf!
_________________________



Top
#178729 - 2007-08-06 05:44 PM Re: KiXgolf: Top Secret [Re: Jochen]
Allen Administrator Online   shocked
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4549
Loc: USA
Congrats Jochen... I think just getting this to work is an achievement in itself.

I've started over 5 times now. So close each time...

Top
#178730 - 2007-08-06 05:51 PM Re: KiXgolf: Top Secret [Re: Allen]
Jochen Administrator Offline
KiX Supporter
*****

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

I daresay I can feel your pain
_________________________



Top
Page 1 of 10 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.077 seconds in which 0.027 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