#183413 - 2007-12-08 12:36 AM
KiXgolf 2007: Taunt Generator - Private Round
Loc: Boston, MA, USA
X-Mas Present!: Private coding extended to December 16!
Your repulsive steed masquerades as a ill-tempered coconut!
The Challenge: Taunt Generator
In all the annals of knighthood, no personality trait has been in more dire need than the fortitude to withstand the diplomatically deleterious effects of a vicious, relentless taunting. Tasked with strengthening the mental endurance of Camelot's knights, King Arthur's court decided that instructional taunting must be applied, yet it could not be delivered by the chivalrous administration.
Thus, Sir Lancelot commanded a local anarcho-syndicalist peasant to write a program that generates taunts (a.k.a. mudslinging) thereby producing a script to test the patience of knights in a training environment. To prevent unbridled creativity in taunting from spoiling the otherwise stately proceedings of a noblemanís education, the following rules designed by committee (The Round Table) must be adhered to:
<taunt> ::= <sentence> | <taunt> <sentence> | <noun>! | <sentence>
<sentence> ::= <past-rel> <noun-phrase> | <present-rel> <noun-phrase> | <past-rel> <article> <noun>
<noun-phrase> ::= <article> <modified-noun>
<modified-noun> ::= <noun> | <modifier> <noun>
<modifier> ::= <adjective> | <adverb> <adjective>
<present-rel> ::= your <present-person> <present-verb>
<past-rel> ::= your <past-person> <past-verb>
<present-person> ::= steed | king | first-born
<past-person> ::= mother | father | grandmother | grandfather | godfather
<noun> ::= hamster | coconut | duck | herring | newt | peril | chicken | vole | parrot | mouse | twit
<present-verb> ::= is | "masquerades as"
<past-verb> ::= was | personified
<article> ::= a
<adjective> ::= silly | wicked | sordid | naughty | repulsive | malodorous | ill-tempered
<adverb> ::= conspicuously | categorically | positively | cruelly | incontrovertibly
Please note that "::=" denotes "is defined as" and "|" denotes an OR. Thus, a "past-verb" is defined as either the word "was" or the word "personified".
Note that all phrases in double quotes are to be treated as one word for taunt simulation output. The number of taunts elicited at any given time is derived from the number of words spoken by the knight. For every three words (or fraction thereof) delivered by the knight, the generator produces one or more taunts in a theater-style script format. In the event that 2 taunts must be produced on a single line, they will be counted as 2 taunts towards the total required. By a mandate from the masses, a word will always contain at least one alphabetic character, and will be separated from other words by at least 1 space. In exception to the above rules, whenever the program finds the holy grail, which is to say, the letters t-h-e-h-o-l-y-g-r-a-i-l (case insensitive) in that order in a line of input, then the first taunt generated will be displayed by the program as "(A childish hand gesture)".
To ensure all royal quality assurance criteria are met, the program must be demonstrated by a simulation showing the taunts produced from a series of inputs. Each taunt is generated by applying the taunt generation rules until all of the <...> have been replaced with appropriate words.
In most cases, you will face a choice of alternate rules for expanding a phrase name.In these cases, you should make a choice as follows: Suppose that this is the kth such choice that you have faced for that rule since the start of program execution, and that you must choose one of n rules for expanding a given kind of phrase. Let the rules for that phrase be numbered from 1...n in the order of appearance above, and then choose rule number ((k-1) mod n) + 1.
Well, get on with it!
A download is available at http://s91376351.onlinehome.us/kixtart/kixgolf_tg.zip
Inputs & Outputs
Input: The input will consist of an array with an unspecified number of lines (elements). Each line will contain a statement uttered by a knight consisting of letters, digits, the characters ",.-!?" and the space character. Each line of input will be more than 1 character and less than 72 characters in length. All words will be separated by space characters. Each statement will contain at least one word.
Output: For every line of input, generate a block of output containing the following:
- A single line containing "Knight:", a space, and the input. Any appearance of space characters inside the input will be replaced by a single space.
- All taunts (as explained in the above rules) prefaced by "Taunter:" and a space, the taunt, and a period. Each word should be separated from neighboring words by a single space. One taunt per line.
- A blank line
Each taunt should begin with a capital letter, and no extra characters should be added.
Thus, the input will be an array of lines. The output will then be an array of lines as well.
Are you feeling alright?
Is there someone else I could talk to?
Anyone at all?
We seek the holy grail . . .
Taunter: Your mother was a hamster.
Knight: Are you feeling alright?
Taunter: Coconut! Your steed is a silly duck.
Knight: Is there someone else I could talk to?
Taunter: Your father personified a herring.
Taunter: Your grandmother was a newt.
Taunter: Peril! Your king masquerades as a conspicuously wicked chicken.
Knight: Anyone at all?
Taunter: Your grandfather personified a vole.
Knight: We seek the holy grail . . .
Taunter: (A childish hand gesture).
Taunter: Your godfather was a parrot.
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 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 are part of the KiXtart golf challenge.
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 and code 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.
32) Additional test cases can be added during the private round by submitting a proposal for a new test case to the BBS. The proposed test case becomes official once it has been added to the existing test cases and the KiXgolf package has been reposted for download. If new test cases are added within 12 hours of private round end the private round will extend by an additional 24 hours. The public round will then start one day later and also end one day later. Not additional test cases will be added during the public round.
KiXtart GOLF - The Duration of the Competition
1) Private coding phase: From date/time of posting the tournament challenge to Sunday, December 16 10pm EST (BBS+6 time)
2) Public coding phase: From Sunday, December 16 10pm EST (BBS+6 time) to Wednesday, December 19, 10pm EST (BBS+6 time)
3) Final results: Thursday, December 20
You will need the complete package from http://s91376351.onlinehome.us/kixtart/kixgolf_tg.zip.
Edited by Sealeopard (2007-12-08 08:41 PM)
There are two types of vessels, submarines and targets.
Moderator: Arend_, Allen, Jochen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Mart
and 275 anonymous users online.