|This is the archived CodeCup 2004 website.|
Click here to go to the new CodeCup website.
Rules of the game Lucky Words
This game is described in the (Dutch) book "Opperlandse Taal en Letterkunde" by Battus, with the difference that the original game is played on 5 by 5 grids.
Two players each draw a square diagram of 7 by 7 cells. This diagram will be filled with letters during the game. In each move, both players add the same letter to their diagrams, but they don't necessarily put the letter in the same cells. The diagram is kept hidden from the opponent until the end of the game.
At the start of the game, one letter is randomly chosen. Both players must put this letter in the central cell of their diagrams. During the rest of the game, the players take turns in calling out a letter. Both players then write down this letter in any empty cell on their diagram. After 48 turns (24 turns for each player), both diagrams are full and the game ends.
Goal of the game
Each player tries to make horizontal (left to right) or vertical (top to bottom) words in the diagram. At the end of the game, the number of word points in the diagram is determined. Longer words give more points: a seven-letter word gives 13 points, a six-letter word gives 8 points, and words of 5, 4, 3 or 2 letters will gain 5, 3, 2 or 1 points. Each cell can be used in only one word in each direction (see below).
The winner of the game is the player with more wordpoints than his opponent. If both players have the same number of word points, the game ends in a draw.
Counting word points
A list of all words for which wordpoints are given, is kept in the file words.dat. Each word in this file is on a line by itself. During the game, this file is available to your program in the current directory. It is allowed to use the same word in more than one place in a diagram.
The number of wordpoints in a diagram is equal to the sum of the wordpoints of all valid words in the diagram. However, a diagram cell can be used in at most one horizontal word and at most one vertical word. In the case of overlapping words in the same direction, only one of the words will get points; in such cases we always select the words that give most wordpoints. Crossing horizontal and vertical words are no problem at all; both words can get full points since the crossing cell is used in different directions.
You can download the file words.dat from this website.
The same list is used during the competitions.
Dialogue between players
Your player program receives letters as input, and writes letters and diagram positions as output. Letters are given as upper case letters from the latin alphabet (A .. Z). Positions in the diagram are identified by numbers (see the figure below).
The first line of input contains the starting letter which is automatically
placed in the center of the diagram (at position 24).
If your program should start with choosing a letter, the second line of input will contain the word start.
If your opponent starts with choosing a letter, the second line of input will contain the letter of his choice.
Note that your program receives just the letters picked by your opponent, not the positions where the letters are placed on his diagram. The same thing is true for your opponent of course, so your diagram is effectively kept hidden from your opponent during the game.
After you have placed the final letter on your diagram, you may calculate your own total number of wordpoints and write this number on a line to the output. You must do this if you participate in the first round of the Dutch National Olympiad in Informatics (NIO); you can get points for this in the first round of the olympiad. For CodeCup contestants with no connection to the NIO, this is just optional; it will look nice on the results page but it will not help you to win the competition.
The table below shows an example of the start of a game.
Of course, each program can only see his own input and output.