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

CodeCup 2005

Rules of the game Lamistra

Stratego is a game published by Hausemann & Hotte BV (Jumbo) Amsterdam the Netherlands. All copyrights with respect to the Stratego game and all adaptations thereof belong to Jumbo. Jumbo is owner of the trademark Stratego. Jumbo has authorized the adaptation of Stratego by Stichting NIO in the form of Lamistra for the purpose of NIO and the design of programs by the participants on the basis thereof. Use of Stratego and Lamistra other than through the design of the program in the course of NIO and any other use of the program a than strict personal use is not permitted and will be considered an infringement of the rights of Jumbo. .

Basic rules

You know the game Stratego: Two players place their pieces on a board so that the opponent cannot see them. After this they move the pieces, trying to capture the opponents flag. Ministratego is the same game, but played on a smaller game board, reducing the number of pieces. Latent Ministratego or Lamistra adds a new element: You can postpone the choice for the value of a piece until you or your opponent make a capture. Of course it is requested that the choice you make at that instant is consistent with the game history so far.

Lamistra is played on a grid with 7 by 7 cells. These cells are named like in chess; the cell left at the bottom is called a1, the cell right at the top is called g7. The cells b4 and f4 are called lakes; these cells can not be entered by the pieces.

Both players can use 21 pieces. These pieces get a role during the game. The possible roles are:

RoleNumberRankSymbolSpecific details
Flag1-VThis is the piece to take. It is not allowed to move the flag.
Bomb4-BIt is not allowed to move a bomb; only the miner takes a bomb, all other pieces will be destroyed.
General11GHighest piece in rank; can only be captured by the spy.
Miner44MThe miner is capable of capturing a bomb.
Spy16SThe spy can capture the general, but he will be captured by every piece when attacked.

Red starts, with the pieces placed on the cells a1-g3, blue plays with pieces on a5-g7.

A move is represented with a 5 character string: The name of the initial place, a minus-sign and the name of the destination (for example a3-b3 or c2-c3).

When your program has to decide which role a piece gets, a symbol from the table above has to be used (See also the example for input and output). All symbols for roles are upper case.

The following rules apply for Lamistra:

  • Players move and must move in turn; red makes the first move.
  • Pieces are moved one square at a time either forwards, backwards, to the right or to the left.
  • The lakes, cells b4 and f4, are forbidden areas.
  • No more than one piece may stand on a square.
  • In consecutive moves a piece may not be moved back to the cell that it came from unless at least one of the moves consists of capturing another piece.
  • A piece, other than a bomb or a flag, may attack an opponents piece that stands immediately in front of, behind, or to the right or left of it. This is always optional. The player indicates the cell of his own piece and the cell of the piece he wants to attack. He also reveals to the game director the role of the attacking piece. The game director presents the attack to the opponent, without revealing the role of the attacking piece. The opponent now presents the role of the attacked piece to the game director.
  • If a piece already got a role, this role should be maintained.
  • A piece without a role, can only get a role that is still available.
  • A piece that has already moved can not get a role as a flag or a bomb.
  • The game director reveals to both players the role the opponentĘs piece. The lower-ranking piece loses the attack and will be removed from the game board. If the attacking piece is the winning piece, it will be placed in the cell of the removed piece. If the attacked piece is the winning piece, it will remain in it's cell.
  • If pieces are of equal rank, both are removed.
  • A general beats a colonel, a colonel beats a lieutenant and so on; everyone beats the spy.
  • If the spy attacks the general, the spy wins. If the general attacks the spy, the general wins.
  • Any piece that attacks a bomb, loses the attack; the only exception is the miner. When a miner attacks a bomb, the bomb loses and the miner takes its place
  • A bomb is not able to attack, only to be attacked.
  • If a playerĘs flag is attacked, he loses the game.
  • If a player can not make a move, he loses the game.
  • A game in which both players made 200 moves, without a decision, is declared a draw.


Write a program that reads input from standard input and writes output to standard output. Your program reads one line of input and outputs a move, based on and consistent with the information known so far. This will be repeated until the games ends. At the end of the game your program has to exit normally.

If the first line of input contains the word 'Start' , it means your program will play red and has to move first. If the first line is a move, than that is the move of your opponent and you will have to play blue.

When it is your programs turn to move, you have to choose a move. You will output a line with this move. If you are performing an attack, your program will output a second line stating the role of the attacking piece, even if this role was already known. Now the time for your program stops until the opponent has reacted. If your opponent performed an attack, you will output a line stating the role of the attacked piece, even if this role was already known. Now you will get an input line containing the role of the attacking piece. Then it is your turn to move.

For a game your program can use 30 seconds. This time will be measured on a competition machine, Pentium IV, 2.8 GHz, with 64 MB internal memory available for your program. This time may be divided between your moves the way it suits you best. Only the time between reading input and writing output will be measured.

Your program will be offered only valid input lines: Legal moves, valid pieces. When your program or the program of the opponent has made an irregularity, you will read a line containing 'X' meaning that you will have to close your program. If a flag is captured, your program also will have to be closed.

In all cases when the game is ended, your program must exit. This will occur in the following situations:

  • Your program captures the opponents flag.
  • The opponent captures your flag.
  • Your program has no valid moves left.
  • Your opponent has no valid moves left.
  • Both players have used their 200 moves.


  • Assume that both players have used their 200 moves, when Blue's last move is a capture. Both players will have to output the rank (symbol) of their pieces before exiting their programs.
  • When both players made their 200 moves, and Red is unable to move, the game will still be declared a draw.

Example input and output

Move Input Red Output Red Input Blue Output Blue
Start of the gameStart
d3-d4 (Red)d3-d4
d5-d4 (Blue)d5-d4
c3-d3 (Red)c3-d3