|
Abstract
A number of chessboard placement and closely related puzzles are examined and formulated as Integer Programs. These puzzles require the participant to place pieces on a board according to certain constraints and may be generalized to boards containing any number of squares, and pieces displaying properties unfamiliar in the game of chess.
1. Introduction
The literature on recreational mathematics contains many references to puzzles that require the participant to place pieces on a chessboard according to specific constraints (Dudeney,
1917;Kraitchik, 1942; Schuh,
1943). These may be generalized to boards containing any number of squares and to pieces displaying properties not permitted in the game of chess. By formulating the problem situations as Integer Programs, the solutions to puzzles of this type may be methodically deduced. A few examples of these chessboard placement problems, and the IP models to solve them, will be presented in this paper. The aim is to encourage the use of such puzzles in an educational context to improve and develop modeling skills.
The applicability of a known technique from the field of OR/MS to the seemingly unrelated context of puzzles for leisure has educational implications. If OR/MS techniques can play a role in games for fun, then, conversely, games may have a role to play in teaching OR/MS.
‘Making learning fun’ as a means of motivating students to learn is an established teaching approach, well documented in the literature on school and higher education (Gage & Berliner,
1992; Walkin, 1990; M.Rawson, 1999). The value of game playing, specifically, to encourage active rather than passive learning has also been expounded (D.Adams,
1973; Cowan, 1998).
Students of business in universities come from a range of educational backgrounds. For some, mathematics may be a subject that they have not recently studied and, of which, they have less than fond memories. Integer Programming techniques, requiring an understanding of mathematical logic and the ability to use mathematical notations, may well be anxiety provoking to such students. The usefulness of integer programming in making operational decisions is not likely to be sufficiently motivating in such cases. As teaching tools, the beauty of puzzles and games is in their capacity for mass appeal and in that they do not, on the face of it, have anything to do with the more serious and contextually dry worlds of business or mathematics. As Martin Gardner (1975) puts it:
“No student is motivated to learn advanced group theory, for example, by telling him that he will find it beautiful and stimulating, or even useful, if he becomes a particle physicist. Surely the best way to wake up a student is to present him with an intriguing mathematical game, puzzle, magic trick, paradox, limerick or any score of things that dull teachers tend to avoid because they seem frivolous.”
In Britain, the Department for Education’s Numeracy Initiative in schools seeks to echo this attitude in its guidelines for teaching mathematics in British schools. The sense of satisfaction at solving a puzzle, the buzz of discovery, the joy of ‘winning’ are all recognized as intrinsically motivating forces
(DFE, 1999; Anderson et al, 1997).
The growth of international students among the UK universities means that it is increasingly important to find methods and techniques to encourage learning that have cross cultural application and appeal (Glauco de Vita,
1999). The puzzles we discuss in this paper, being based upon or closely related to the universally popular game of chess, fulfil this requirement.
2. A Pot-Pourri of Placement Puzzles
A number of chess piece placement problems are now described together with a few problems that are similar enough in structure to warrant discussion in this context.
2.1 Standard Chess Piece Placements
The Non-attacking Queens Problem
What is the maximum number of queens that can be placed on a chessboard such that no queen is attacked by another.
The Queen Domination Problem
What is the minimum number of queens that can be placed on a chessboard so that each square contains a queen or is attacked by one.
Non-dominating Queens
A puzzle referred to as ‘the non-dominating queens problem’ has been considered at some length in the literature. That is, place
n queens on a board of order n in such a way as to maximise the number of squares not under attack. The formulation of this is straightforward but as
n increases the solutions provide a challenge to current I.P. software. Mario Velucchi summarises the progress made and gives optimal solutions for boards up to and including order 16 and best known solutions for boards up to and including order 30.
Bishops, Rooks and Knights
The ‘Non-attacking’ and ‘Domination’ problems above have also been considered in the literature for Bishops, Knights and Rooks.
The most popular of these is perhaps the knight domination problem and is usually presented in one of two forms. That is, where occupied squares
must be under attack and where occupied squares must not be under attack.
Foulds and Johnson
(1984) formulate non-attacking problems for rooks, bishops, queens, knights and kings and prove that, in each case, the constraint matrix is totally unimodular.
Rook placement puzzles are less well represented in the literature as the solutions are easily achieved by casual inspection. For example, the
minimum number of rooks that may be placed on the board such that every square is attacked is eight – there
must be one on every rank or one on every file. The maximum number of rooks that
may be placed such than none are attacked by any other is also eight - there may be one on each square of a main diagonal.
Nevertheless, the simplicity of the rook’s move will provide us with a useful starting point in our analysis and there are lessons to be learned that will be of benefit in the consideration of the less accommodating pieces.
2.2 The Crowded Board
“You are given a chessboard together with 8 queens, 8 rooks, 14 bishops, and 21 knights. The puzzle is to arrange the 51 pieces on the chessboard so that no queen shall attack another queen, no rook attack another rook, no bishop attack another bishop, and no knight attack another knight. No notice is to be taken of the intervention of pieces of another type from that under consideration - that is, two queens will be considered to attack one another although there may be, say, a rook, a bishop, and a knight between them. It is not difficult to dispose of each type of piece seperately; the difficulty comes in when you have to find room for all the arrangements on the board simultaneously.”
(Dudeney, 1917)
2.3 Detective Chess
This type of puzzle was originated by Jaime Poniachek and explored by Martin Gardner in
Isaac Asimov’s Science Fiction Magazine, reprinted in Gardner’s Puzzles from other
Worlds.
A number of chessboard squares are marked and these squares are to be occupied by a given set of pieces (pawns are not included). The objective is to deduce which pieces must occupy each of the marked squares. Clues are given in the form of numbered squares and these represent the number of attacks on the respective square. A sample puzzle is given below.
 Figure
1: Detective Chess
The puzzle has been programmed by Gerry Quinn
(http://indigo.ie/~gerryq/Det/Det.htm). His implementation has the facility to generate random puzzles on a range of board sizes and with a variety of pieces for placement including several borrowed from ‘Fairy’ chess. Each puzzle generated has a unique solution.
2.4 The Gentle Art of Stamp Licking
“If you have a card divided into sixteen spaces (4 x 4), and are provided with plenty of stamps of the values 1d., 2d., 3d., 4d., and 5d., what is the greatest value that you can stick on the card if the Chancellor of the Exchequer forbids that you place any stamp in a straight line (that is, horizontally, vertically, or diagonally) with another stamp of similar value? Of course, only one stamp can be affixed in a space.”
(Dudeney, 1917)
2.5 5-by-5 (http://www.chlond.demon.co.uk/Five.html)
Each of the squares in a 5-by-5 grid can be in one of two states, lit or unlit. If the player clicks on a square then that square and each orthogonal neighbor will toggle between the two states. Each mouse click constitutes one move and the objective of the puzzle is to light all 25 squares in the least number of moves. The starting configuration has all 25 squares unlit.
2.6 Lights on (http://www.chlond.demon.co.uk/Lights.html)
This is a puzzle similar to 5-by-5 but is played on a 4-by-4 grid. The squares affected by a mouse click are the current square and all those squares within a single rook’s move. Again the objective is to light up all squares. The starting configuration is generated with a random selection of squares already lit.
2.7 Equal Vision
A watchman looks in all directions (horizontal, vertical and diagonal). On the board below, each watchman has five vacant cells under his gaze. A watchman can see beyond another watchman. What is the maximum number of watchmen that can be placed so that each sees six empty cells? What if each watchman must see seven empty cells?
(Poniachek, 1998)
 Figure 2: Equal Vision
2.8 The Abbott’s Window
Dudeney’s description of the Abbott’s Window is quaint though unnecessarily convoluted. The puzzle in effect consists of an
8-by-8 grid where individual squares must be covered in such a way that all horizontal, vertical and diagonal lines contain an even number of uncovered squares. An added condition is that each corner square must not be covered.
3. Tools of the Trade
A collection of useful modeling structures is now presented. These include subscript and variable definitions, constraint generation expressions for the various pieces and a brief discussion on the modeling of logical conditions.
We will adopt the notation i = 1..s for row subscripts and j = 1..s for column subscripts, where s = size of board, i.e. for standard chessboard, s=8.
Binary variables, xi,,j, are defined for each square, {i,j}, such that if square {i,j} is occupied then xi,,j=1, otherwise xi,,j=0.

An expression is required to compute the number of attacks on a specified square from pieces elsewhere on the board. If ni,,j = number of attacks on square {i,j} then:

3.1 Rook attacks

3.2 Bishop attacks

3.3 Queen attacks
The computation of queen attacks on each square is, quite simply, a concatenation of the equivalent expressions for bishop and rook.

3.4 Knight attacks
The knight attacks are perhaps the most awkward to model in that the moves defy easy definition. Even Dudeney was exasperated by the knight’s shenanigans and his contempt for the piece is made clear by his remark, “The knight is the irresponsible low comedian of the chessboard”. He goes on to quote an unnamed American writer who states, “He is a very uncertain, sneaking, and demoralizing rascal”. There seems to be no elegant way to capture the bizarre antics of this particular ‘rascal’.
Notwithstanding the difficulties of deriving a single succinct statement to summarize the knight attacks on each square, the following compromise is presented for consideration and improvement.
Consider a 12-by-12 (S=s+4) board where the outer two ranks and files consist of ‘dummy’ squares. The actual chessboard consists of the central 64 squares. Then

computes the number of knight attacks on each real square.
In addition

ensures that no knights are placed on
dummy squares.
3.5 A general constraint
An alternative approach is to construct a general constraint that is appropriate for all the pieces. If A{i,j} is equal to the set of squares that if occupied by the piece under consideration would be able to attack square {i,j} then the statement to define ni,j would be the same for each piece.
This seems to provide a more elegant formulation but is perhaps a little less easy to follow. Also, in order to model this using I.P. software it would be necessary to construct statements to define A{i,j} for each different piece separately.
3.6 Non-attacking constraints
Sections 3.1 to 3.4 contain statements that are of general use in the modeling of placement problems. However, non-attacking problems in particular may be formulated more efficiently by considering ranks, files and diagonals rather than individual squares. For example, if each rank and file contains no more than one rook, then no two rooks are attacking each other. The model for ‘The Crowded Board’ problem (section 4.4) illustrates this in more detail.
3.7 Logical constraints
Many of the placement problems require squares to be attacked or not attacked according to some specified condition, for example, maximize the number of pieces on the board such that all
unoccupied squares must be under attack and all occupied squares not under attack. Williams
(1999) demonstrates the use of binary variables to model logical conditions. For our purposes, it is useful to define binary variables for each square, ai,,j, such that if square {i,j} is attacked by one or more pieces then ai,,j=1, otherwise ai,,j=0. This may be achieved as follows:


Where M is a suitable upper bound on all ni,,j. Note that a tighter formulation is possible by defining Mi,j as upper bounds for each ni,j.
The first statement forces ai,,j to 0 if ni,,j=0 and the second statement forces ai,,j to 1 if ni,,j > 0. It is usually unnecessary to include both of these statements to ensure a valid solution (see below).
These binary variables may in turn be used to ensure that the conditions of the problem under consideration are fulfilled. Taking the above example where unoccupied squares are attacked and occupied squares are not attacked, the constraints are written as follows:
This statement ensures that every square is either attacked or occupied, but not both. The problem here is to maximize the number of pieces placed which in effect will minimize the number of squares under attack. It is only necessary to force the ai,,j variables to 1 if the square is under attack, the converse will be implicit in the objective function.
3.8 Objective functions
In many problems, the aim is to find the maximum or minimum number of pieces that may be placed on the board without violation of some condition. In such cases, the objective function is:
In other problems, the aim is to place a given set of pieces according to specified conditions. In these cases, any suitable objective function may be chosen, so that a feasible solution is obtained.
4. A Menagerie of Models
We are now in a position to formulate the puzzles described in Section 2.
4.1 Bishop placements




4.2 Queen placements
The two common queen puzzles, that is, queen domination and maximum queens, are formulated as for the bishop problems except that the bishop attack constraints are replaced with those of the queen.
4.3 Knight domination
The two knight domination puzzles described in Section 2.3 are modeled by combining the structure developed in Section 3.4 to compute the number of knight attacks on each real square with the logical constraints presented in Section 3.6.
In addition

ensures all real squares are attacked.
Alternatively

ensures only unoccupied real squares are attacked.
4.4 The Crowded Board
The objective of this puzzle is merely to place all the pieces subject to the constraints, hence, any suitable objective function will suffice.
The subscript k may be used to represent each piece type to be placed (1 = queen, 2 = bishop, 3 = knight, 4 = rook) and decision variables defined as follows:
x i,j,k = 1 if piece type k is placed on square {i,j}, 0 otherwise
The requirement to place a number of knights on the board necessitates the use of the artifice introduced in Section 3.4, that is, we need to consider a 12x12 board where the outer two ranks and files consist of ‘dummy’ squares.and a set of constraints is included to ensure that no pieces are placed on dummy squares (see Section 3.4).
Constraints are required to ensure that the correct number of each piece type are placed on the board and that each square contains, at most, a single piece.
The statements required to model the condition that no two queens attack each other are listed as follows.
Firstly, it is necessary to ensure that each rank and file contains, at most, one queen.


Secondly, each diagonal must contain, at most, one queen.




Similar statements are required to ensure that each rank and file contains, at most, one rook, and each diagonal contains, at most one bishop.
An extension of the structure presented in Section 3.4 ensures that each knight is not under threat by any other knight.
4.5 Detective Chess
The Detective Chess puzzles, in their original form, are easily modeled as integer programs. Consider the following example.
Marked squares are {1,1},
{1,5}, {4,3}, {4,6} and {8,7} and will be referred to as squares
1 to 5 respectively. Squares {3,6},
{4,7} and {5,5} are numbered 2, 1 and
0 respectively and we will refer to these as target squares. The pieces to be placed are a single King, Queen, Rook, Bishop and Knight and will be referred to as pieces
1 to 5 respectively.
Let xi,,j
= 1 if square i is occupied by piece j, 0 otherwise.
The equations

and

are assignment constraints; they ensure that each square is occupied by exactly one piece and that each piece is placed in exactly one square.
The equations



ensure that the target squares are attacked by the required number of pieces.
Any linear objective function will suffice, as the aim of the problems is merely to fulfil the constraints
Quinn’s implementation provides for further exploration of the idea. In particular, the ‘All Numbers’ game is an interesting development. In this mode, the numbers of attacks are given for all squares but no clues are forthcoming as to the location of the pieces to be placed. This presents the trainee modeler with a more strenuous exercise and offers the opportunity to bring into play the full range of tools developed above.
4.6 The Gentle Art of Stamp Licking
Define variables as follows:
s = 4 - size of grid
k = 1..5 - values of stamps
x i,j,k = 1 if stamp of value k is placed on square
{i,j}, 0 otherwise
a i,j,k – dummy variables
Maximise the total value of stamps placed:

Each square contains, at most, one stamp:

a i,j,k =
1 if square {i,j} is in line with stamp of value
k:
|