Programming Contest

The deadline for submissions was 2pm GMT on Saturday 2007-03-03. Many thanks to everyone who entered.

For results of the competition, read the judges' report or listen to a summary. The entries themselves are also available in tar and zip formats. The file "judge.lisp" is the judges' test harness.

1. Introduction

How well can you play Continuo? How well can you play it in lisp?

Continuo is a game for 2-5 players which involves them taking turns to place coloured cards on the table and scoring points according to how well they do it.

The 42 cards are squares. The face of each card is covered by a 4x4 grid of smaller coloured squares. Just four colours are used: red, green, blue and yellow. The cards are illustrated in section 3 below. Because of symmetry and other regularity, you can totally specify each card by naming (in order) the colours along any edge. We'll always work from the top-left corner with the cards as illustrated. For example, the first card in the last row would be specified by the keyword :yrgy.

The method of play is this: when it's your turn you take an unused card (in the physical game they're shuffled and placed in a pack face-down) and place the card so that it touches at least one of the cards already played but does not overlap any of them. Note that the cards have to touch edge to edge but don't have to join along entire edges. To score, you sum the sizes (in small squares) of all newly-enlarged single-colour connected regions. See section 4 for some examples.

Your entry should play the game in one-player mode. It should accept card specifications, in the form of keywords as above, and should produce card placements (top corner coordinates and orientation) and the scores corresponding to these placements. Each placement is to be produced before the next specification is provided. Each entry will be given the same sequence of all 42 cards. The aim is to maximize the total score of all the moves.

1.1. Functional specification

Each entry should define the following two functions. The symbols naming them should be visible from the CL-USER package.

Function clear takes no arguments and "clears the board", resetting the game to its initial state.

Function play takes the keyword describing a card as its argument and returns a list of four elements:

where x and y are integers specifying the top-left coordinate of the card (in small-square units), increasing values taking you down and to the right; spin is a boolean indicating whether or not the square needs to be rotated (90o, either way) from its default orientation; and score is the score claimed for this move.

For example (see section 4):

(play :bgbg) => (0 0 t 0)          ; the first move doesn't score anything
(play :rbgb) => (4 -1 nil 14)
(play :rbry) => (5 3 nil 10)
(play :bgby) => (1 4 t 18)

In order to time program execution, the judges will run the code akin to the following:

(let ((cards (judge:generate-cards))) 
   (progn (clear)
	  (mapcar 'play cards))))

2. Contest

The aim in this contest is for you to write a program, in Common Lisp, to play Continuo.

By entering the contest, you are deemed to have accepted all of the following, so please read them carefully.

  1. The deadline for submissions will be 2pm GMT on Saturday 2007-03-03 (universal time 3381919200). You may submit more than one entry, but only your last submission (before the closing date) will be judged.

  2. Entries may be submitted only by email, which should be sent to . If such email would be over 1 megabyte in length, please send instead a short message to this address stating how your entry can be acquired by some other electronic means (http / ftp, etc).

  3. Prizes may be awarded in the following categories:

    • highest scoring program;

    • first answer to be submitted which plays the game "half decently" (the definition of which being totally up to the judges at the time of judging, but might involve scoring at least as well as half the other entrants);

    • fastest running program which plays the game "half decently":

      • this is to be defined by the total time, as measured by time, taken to read source, expand macros, compile code, load compiled code, and execute it, plus anything else we forgot to mention here; the judges will take steps to integrate each entry into the implementation used for the timings, in such a way as to ensure a level playing field for each entry;

      • this is a test of algorithm, not of use of optimizations, therefore (a) no type declarations or the forms will be permitted and (b) the judges reserve the right to run entries on the lisp implementation(s) of their choice;

    • most elegant algorithm;

    • most elegant use of lisp;

    • best use of really obscure lisp features;

    • contestants under the age of 21 on the first day of the conference (you'll have to tell us that you're under 21, otherwise we won't know);

    • facilities (e.g. a harness plus an extended specification for entrants) to permit entrants to play "head to head" at the conference;

    • best "added value".

    The judges reserve the rights (a) not to award a prize in any category if they do not believe the standard of entries in that category merits it, (b) to create additional prize categories after the closing date for submissions and (c) to entertain any suggestions, which are received before the deadline for submissions, for other categories.

  4. Names of prize winners will be announced at the conference, and subsequently on this website.

  5. In order to qualify for a prize, the entrant must register for at least one day of the conference. Prize-giving might be on Monday April 2nd, but that's not a firm date yet.

  6. The prizes will be tasteful medals of low scrap-metal value. As if fame wasn't enough.

  7. Entries are to consist of source code, plus sufficient documentation (potentially in the form of comments) to allow the judges to (a) build and run the program and (b) understand the algorithm employed to solve the puzzle.

  8. Please include with each entry a list of any sources (e.g. publications, internet sites, etc) used to generate that entry.

  9. Team entries will be allowed. Please indicate with your entry if this is a team effort, and name the particpants. At least one member of the team must register for at least one day of the conference.

  10. All entries will be tested on the same machine: a laptop running Windows XP. If you intend to submit an entry which cannot be run on this machine then you are advised to consult with the judges beforehand. You may be responsible for bringing hardware to the conference on which to demonstrate your entry, and - depending on the speed of that hardware - your entry may not be eligible to win a prize under the "fastest running program" category.

  11. If you intend to submit an entry which is not written portably then you are advised to consult with the judges beforehand. The judges will make reasonable efforts to obtain particular lisp implementations on which to test entries, provided there is sufficient justification for doing so. Use of an implementation-specific UI will be considered to be a "sufficient justification".

  12. Employees of David Westnedge Limited and of Ravenbrook Limited, the judges, and the immediate families of all of these, are not eligible to enter this contest.

  13. The judges will be Nick Levine and Nicholas Barnes. The judges can be contacted by email via . The judges' decision will be final in all matters, including whether or not to enter into any correspondence.

  14. Although each entry will remain the intellectual property of the entrant, the judges may demonstrate and publish winning entries at the conference, and may publish them in conference proceedings and on this website. Entries must be licensed in such a manner as to permit these activities freely.

3. The cards

Each card has up to three distinct colours, in the pattern


such that (not (or (eq A B) (eq B C) (eq C D))). No two cards are identical. It's trivial to see that this specification permits 6 cards ABAB, 24 cards ABAC, and 12 cards ABCA. The 42 distinct such cards form the deck.

4. Example of scoring

(See also section 1.1, for the corresponding lisp.)

4.1. First two cards

One chain of 6 in green, two chains of 4 in blue. Score (+ 6 4 4) -> 14

4.2. Third card

One chain of 6 in blue, one chain of 4 in red. Score (+ 6 4) -> 10

4.3. Fourth card

Two chains of 7 in blue, one chain of 4 in green. Score (+ 7 7 4) -> 18

5. Material added to this page since it was first posted

Last updated: $Date: 2007/05/04 $.

The game Continuo is copyright (c) Maureen Hiron 1982. References to Continuo on this website are specifically only for the purpose of the programming contest described above, and this use is under licence from the inventor, Maureen Hiron, and the game's UK distributor David Westnedge Limited (). None of the card designs included in this website may be reproduced, by any means whatsoever, other than for purposes directly related to this contest.

This document is copyright (c) Nick Levine 2007. All rights reserved. It is provided "as is", without any express or implied warranty. In no event will the author be held liable for any damages arising from the use of this document. You may make and use verbatim copies of this document for purposes directly related to this contest. You may not mirror this document or any of the images herein on another website. You may not charge anyone for the use of this document.

"Windows" is a registered trademark of Microsoft Corporation. Other brand or product names are the registered trademarks or trademarks of their respective holders.

© alu 2007