Home > Topswops > Description

Topswops

The Task

Suppose you have a deck containing n cards. Each card contains a number from 1 to n, and each number appears on exactly one card. You look at the number on the top card -- let's says it's k -- and then reverse the order of the top k cards. You continue this procedure -- reading the top number and then reversing the corresponding number of cards -- until the top card is 1. Your task, as proposed by John Conway in 1973, is to arrange the order of the cards in the original deck so as to maximize the number of reversals you will do.

Let's look at an example using a 6-card deck. If you arrange the deck as follows (the top card is listed first):

3, 6, 5, 1, 4, 2

you will perform 10 reversals before the top card contains the number 1:

5, 6, 3, 1, 4, 2
4, 1, 3, 6, 5, 2
6, 3, 1, 4, 5, 2
2, 5, 4, 1, 3, 6
5, 2, 4, 1, 3, 6
3, 1, 4, 2, 5, 6
4, 1, 3, 2, 5, 6
2, 3, 1, 4, 5, 6
3, 2, 1, 4, 5, 6
1, 2, 3, 4, 5, 6

The Contest

For each of 25 different values of n, submit (see How to Enter, below) the ordering of a deck of n cards which will maximize the number of reversals. The values of n which you must use are the 25 prime numbers less than 100 (2, 3, 5, ..., 97). There are thus 25 individual problems which you are asked to solve.

You can submit more than one solution for the same problem, but if you do we count only your best solution. There is no penalty for submitting multiple solutions for the same problem.

See The Scoring System, below, to learn how we determine the winner.

The Prizes

First prize is your choice of any Bathsheba Grossman sculpture from one of these pages:

Second prize is your choice of any Bathsheba Grossman sculpture on one of these pages:

How to Enter

Just paste the orderings of your decks of cards into the large box on the Submit page and click the Submit Entry button. Format your orderings as follows:

  • An individual ordering consists of a comma-delimited list of card values.
  • Submit multiple orderings (for different deck sizes) in a single entry by separating them with semicolons. Do not put a semicolon after your last ordering.
  • Include spaces and line breaks anywhere you like (except within a number) to improve readability.

For example, to submit the ordering given in the example above you might enter: 3, 6, 5, 1, 4, 2

Do not submit entries under more than one account. This is important. Do not submit entries under more than one account.

The Scoring System

We give a raw score to each solution you submit. The raw score is the number of reversals your solution requires. The example above for n=6 would receive a raw score of 10.

Each time you submit a solution we will merge it with your prior solutions, if any. The result will be a virtual entry containing your best solutions for each of the 25 problems. We will give each of these 25 solutions a subscore from 0 to 1 and their sum will be your contest score.

We calculate subscores for the individual solutions as follows. If your solution has the highest raw score that was submitted for that problem, we give it 1 point; otherwise we give it only a fraction of a point. The fraction is the solution's raw score divided by the highest raw score submitted by anyone for that same problem.

Let's walk through a simplified example. Suppose that we reduce the contest to only 3 values of n: 4, 6, and 8.

Further suppose that we have 3 entrants (Tinker, Evers and Chance) and that their best solutions have raw scores as follows:

4 cards 6 cards 8 cards
Tinker 5 10 13
Evers 2 13 17
Chance 4 8 18

We note the highest raw score for each problem, as follows:

4 cards 6 cards 8 cards
Highest Raw Score 5 13 18

Finally, we compute the subscores and contest score for each entrant:

4 cards 6 cards 8 cards Contest Score
Tinker 5 / 5 = 1.0000 10 / 13 = 0.7692 13 / 18 = 0.7222 2.4914
Evers 2 / 5 = 0.4000 13 / 13 = 1.0000 17 / 18 = 0.9444 2.3444
Chance 4 / 5 = 0.8000 8 / 13 = 0.6154 18 / 18 = 1.0000 2.4154

If two entrants have the same contest score, we break the tie by giving preference to the entrant whose last improvement was submitted least recently.

Getting Your Questions Answered

First, check the FAQ section below. If you can't find the information you need there, send your question to the discussion group. If your question is of a personal nature, and not of general interest, send an email directly to Al Zimmermann.

The Discussion Group

If you think you might enter the contest, you should join the contest discussion group. You can join either by sending a blank email here or by visiting the group on groups.io. The discussion group serves two purposes. First, it allows contestants to ask for clarifications to the rules. Be aware that sometimes these requests result in changes to the rules, and the first place those changes are announced is in the discussion group. Second, the discussion group allows contestants to interact with each other regarding programming techniques, results and anything else relevant to the contest.

My Lawyer Would Want Me To Say This

I reserve the right to discontinue the contest at any time. I reserve the right to disqualify any entry or entrant for any reason that suits me. I reserve the right to interpret the rules as I see fit. I reserve the right to change the contest rules in mid-contest. In all matters contest-related, my word is final.

Frequently Asked Questions

Can I enter the contest more than once, using different accounts?

No. Submitting entries from more than one account is not permitted.

Can teams enter the contest?

Collaboration is allowed. However, only one of the collaborators may register. If two contestants are found to have collaborated, even if this occurred before one or both registered, both will be disqualified.

What information about my solutions can I share in the discussion group?

There are two types of information that you are forbidden to post. The first is specific solutions. The second is code. You may post scores, so if you want to tell everyone that you got a raw score of 99 for n = 20 (whether true or not), go right ahead. You may also discuss the algorithms you are using.

How can I find out what my individual subscores are?

You can't. I know this is frustrating, but it's a long standing policy that isn't going to change. Over the years it's been hotly debated in the discussion group and the contest administrator appears to have very strong feelings on the matter. You're going to have to learn to live with it. And I'd think twice before raising the issue yet again.

After I submit a solution, the scorer shows me the solution's "canonical representation". What is that?

Arguably, the canonical representation has been of some interest in earlier contests. However, for this contest the canonical representation is always the same as the solution you submitted and is therefore of no interest at all.