#180257 - 2007-09-07 10:36 PM
KiXgolf: A-to-Z - Private Round
Loc: Boston, MA, USA
The Challenge: "A-to-Z"
A-to-Z is a game usually played by kids in elementary schools to help them improve their spelling skills and to enrich their vocabulary.
The game comes with a set of words, each word written on a piece of plastic. Children challenge each other by picking two letters (let's call them C1 and C2) and then trying to connect these letters by finding a sequence of one or more words (we’ll refer to them as W1, W2, . . . , Wn) where the first word W1 starts with C1 and the last word Wn ends with C2. Each two consecutive words in the sequence (Wi, Wi+1) must overlap with at least two letters. Word X overlaps by k letters with word Y if the last k letters of X are the same as the first k letters of Y . Take for example the words below, where 'a' was connected to 's' using the two-word sequence "against" and "students".
To determine the winner of the game, each sequence is assigned a penalty which is equal to the number of letters in the sequence (but overlapping letters are counted only once.) The player with the least penalty wins. Going back to the figure, the first sequence "against students" has a penalty of 13, while the second sequence "about outside ideas" has a penalty of 11. You can think of the penalty as the width taken when the sequence is laid out as in the examples. The winning sequence is the one with the smallest width.
Write a program that takes a dictionary of words and determines the winning sequence connecting two given letters.
A download is available at http://s91376351.onlinehome.us/kixtart/kixgolf_a2z.zip
Inputs & Outputs
Your script will be tested on one or more test cases. Each test case specifies a dictionary of words, and a character pair to connect using the dictionary. The script will provide two inputs into the UDF, namely an array of dictionary words and an array consisting of the beginning and ending letter in array elements 0 and 1, respectively.
The output for each test case should be either an integer number representing the penalty follwed by a space followed by the sequence of chained words where the words are also separated by a single space each or the interger 0 in case no solution was found.
Thus, the output for example 1 would be "13 against students".
You will need to pass all test cases in order for the KiXgolf score to count.
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 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]
for $b=0 to ubound($a)
for a score of 45.
Another solution is:
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 a 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 Wednesday, September 12, 6pm EST (BBS+6 time)
2) Public coding phase: From Wednesday, September 12, 6pm EST (BBS+6 time) to Sunday, September 16, 10pm EST (BBS+6 time)
3) Final results: September 16 after close of tournament
You will need the complete package from http://s91376351.onlinehome.us/kixtart/kixgolf_a2z.zip .
There are two types of vessels, submarines and targets.
#180269 - 2007-09-08 07:30 AM
Re: KiXgolf: A-to-Z - Private Round
Loc: Lincoln, Ne
I added an additional test:
Output=11 about outside ideas
and my previous code failed Test 8 so I have modified my code and the result is 478:
Running Test 1...Done
Running Test 2...Done
Running Test 3...Done
Running Test 4...Done
Running Test 5...Done
Running Test 6...Done
Running Test 7...Done
Running Test 8...Done
Your solution passed all tests
Your solution passed all tests
KiXtart Version = 4.53
KiXGolf Script = kixgolf_A2Z.kix
OS = Windows Vista Ultimate Edition
CPU = Intel(R) Pentium(R) D CPU 2.80GHz
Speed = 2792 MHz
Memory = 2048 MB
KiXGolf Scoring Engine
Scoring Engine = 3.3
KiXtart Golf Score
Tournament = A-to-Z
Processing Start = 2007/09/08 00:29:52.288
Processing End = 2007/09/08 00:29:52.319
Duration = 0000/00/00 00:00:00.030
KiXGolf Score = 478
Thank you for participating in KiXtart Golf!
Press any key to continue...
Edited by Benny69 (2007-09-08 07:31 AM)
#180275 - 2007-09-08 03:32 PM
Re: KiXgolf: A-to-Z - Private Round
Loc: Harrisburg, PA USA
Jens, the new INI file still contains an error for test 7.
The count is currently 7 and needs to be changed to 6.
Output=7 kita tart
Edited by Howard Bullock (2007-09-08 03:32 PM)
Edit Reason: spelling
Moderator: Arend_, Allen, Jochen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Mart
and 328 anonymous users online.