This is the archived CodeCup 2004 website.
Click here to go to the new CodeCup website.
logo  

CodeCup 2004

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.

Basic rules

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.

ABALONE13
XIBIULA3×1
IQIPTIC2
SNOBWAY3+2
ELSAONM2+1
SHEBRAA2+2
WESYKYD1
81+1132+3135380
Final position for one of the players

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.

Word length  7 6 5 4 3 2
Word points  13 8 5 3 2 1

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.

LISTEP
LIST
  T 
  E 
  P 
Overlapping horizontal words; we have to choose between LIST and STEP. Crossing words; both LIST and STEP will get points.

You can download the file words.dat from this website. The same list is used during the competitions.
Download: words.dat (386 kB).

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.
When it is your program's turn to pick a letter, it should produce two lines of output: a line with the chosen letter, followed by a line with the position where your program puts this letter on the diagram. After your opponent has picked a letter, your program will receive his chosen letter as input. You should then produce just one line of output, containing the position on the diagram where you want to put this letter.
The two players continue like this, taking turns at picking a first letter, until the diagram is completely filled.

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.

0123456
78910111213
14151617181920
21222324252627
28293031323334
35363738394041
42434445464748
Identification of diagram cells

Example

The table below shows an example of the start of a game. Of course, each program can only see his own input and output.
Note again that both players are using the same sequence of letters, but the locations where the letters are written on the diagram is kept secret from the opponents.

Player 1 Player 2
 Input   Output   Input   Output   Explanation 
X X Starting letter
start Player 1 will move first
E First move: player 1 picks letter E
35    ... and puts it at position 35
E Input for player 2
0 Player 2 puts the letter at position 0
A Second move: Player 2 picks letter A
22    ... and puts it at position 22
A Input for player 1
6 Player 1 puts the letter at position 6
... and so on ...
Example of the start of a game