Two Programming Contests
Attacking Queens

The contest has ended. The results are available here.

The Attacking Queens Problem

There are several versions of the Attacking Queens Problem. Here are two of them, called simply 3D and 4D.

The 3D version. Suppose you have a 3-dimensional N x N x N chessboard. Place as many queens as you can on it so that no queen attacks any other queen. There are 13 ways in which a queen can move on such a chessboard: parallel to an edge (3 ways), parallel to a face diagonal (6 ways), or parallel to a space diagonal (4 ways).

The 4D version is similar. Place as many queens as you can on a 4-dimensional N x N x N x N chessboard so that no queen attacks any other queen. There are 40 ways in which a queen can move on such a chessboard. Figuring out the 40 ways is part of the challenge.

The Contests

Contest 3D. Send us (see How To Enter below) your best solution to the 3D version of the Attacking Queens Problem for values of N from 1 to 25. The winning entrant will be the one who places the most queens for N = 1. In case of a tie (which is pretty likely) the tie will be broken by comparing solutions for N = 2. Continued ties will be broken by considering solutions for successively higher values of N. In the unlikely event of a tie after N = 25, the winner will be selected at random from among those tied.

Contest 4D. The same as Contest 3D, except that you must solve the 4D version.

The Prizes

Contest 3D.
First Prize: One Hundred Dollars
Second Prize: An Evening with Mike Ecker, or a Prize of Comparable Value
Contest 4D.
First Prize: Two Hundred Dollars
Second Prize: Two Evenings with Mike Ecker, or a Prize of Comparable Value

How To Enter

The two contests are independent of each other. You can enter either or both. If you enter both, you are eligible to win in both.

For each contest, send a separate email for each N. In other words, for each of the two contests send 25 separate emails.

Each email should be addressed to, have just the word QUEENS in the subject line, and be formatted as follows. Use one line for each queen placed on the chessboard. Each line should contain 3 or 4 comma-delimited coordinates specifying where on the board the queen is placed. For a chessboard of size N, coordinates range from 0 to N-1. After the last queen, leave a blank line. After the blank line give your name. The line after your name should contain your city, state or province (if applicable), and country.

Since your entry will consist of multiple emails, you should submit each email from the same email address. Also, entries will be processed by computer, so format them carefully.

Note that it is not necessary to specify which contest (3D or 4D) you are entering or which size chessboard you are solving. That information will be inferred from the coordinates in your solution.

You can send as many solutions as you wish. However, only your best solution for each value of N will be used.

Solutions must be received by Noon, U.S. Eastern Standard Time, on March 1, 2002.

Further information

If you have a question check the Frequently Asked Questions section, below. If your question isn’t answered there, try the contest discussion site. This discussion site is a forum for those who want to discuss techniques for solving the contest and for those who have questions about the contest rules.

To join the contest discussion site, send an email to After you’ve joined, you can email your question to The answer to your question will be posted to the same site.

If you have questions that are not of general interest, send email to Al Zimmermann (the contest administrator) at

Frequently Asked Questions

Can you give an example of a valid contest entry?

Sure. Here’s an entry for Contest 3D for the case N = 3. You can tell that it’s for Contest 3D because each queen’s location is specified with 3 coordinates. You can tell that it’s for the case N = 3 because the largest coordinate in the solution is 2.


Harpo Zimmermann
Portland, Maine, USA

Do I have to submit an entry for every value of N?

No. If there is a particular value of N for which you have not submitted a solution, we will use your solution for N-1. If you haven’t submitted a solution for N-1, we’ll use your solution for N-2. And so on down to 1. For example, if you send us a solution for the 6 x 6 x 6 chess board, but not for either the 7 x 7 x 7 or 8 x 8 x 8 boards, we will use your size 6 solution for the size 7 and size 8 boards as well.

How will I know that you’ve received my entry?

When an entry is received it is processed by the automated Parser/Scorer and a confirmation is sent back to the submitter. Usually, but not always, the confirmation is sent within 24 hours of receipt of your entry.

Where did the idea for this contest come from?

Southern Missouri State University’s Mathematics Department has a web site they call their Problem Corner. This contest was inspired by their Attacking Hyperqueens problem.

Wasn’t there once a movie called "Attacking Queens"?

Actually, there were two. One was a science fiction film about aliens trying to destroy one of New York City’s boroughs. The other was a documentary about gay-bashing.

Attacking Queens Contest Results Al Zimmermann's Programming Contests