// © Copyright 1995, Joseph Bergin. All rights reserved.


#include "Chess.h"
#include <iostream.h>
#include <iomanip.h>
#include "boolean.h"
#include "Array.h"
#include "Error.h"

const int numColumns = 8;

ChessBoard board(numColumns);
Array<Queen> queens(numColumns);
	
boolean placeQueen(int i) // recursive
{	if(i>=numColumns) return true;
	// try each cell on rank i+1. 
	// if can attack any lower numbered queen from there then 
	//	try the next cell.  If you run out of cells to try, return false
	// otherwise (can't attack) then try this cell and place the next
	// queen.  If it returns true then return true, otherwise try the next 
	// cell.  
// (12 lines removed here) 
	return false;
}

void placeAllQueens() // non-Recursive
{	// Try cells on the first row for the first queen and then
	// call placeQueen(1) to get the process started for the 
	// others.  
// 7 lines removed here. 
}

void main()
{	placeAllQueens();
	unsigned int row;
	unsigned int col;
	for(int i=0;i<numColumns;++i)
	{	queens[i].location(row,col);
		cout<<"Queen:"<<setw(1)<<i+1<<"  ("<< row<<','<<col<<')'<<endl;
	}
}

/*	Exercises. 
Find a backtracking solution to the n-queens problem.
Verify that there is a solution for a queen anywhere on the first row.
Verify that there is a solution for a chessboard of any size. 
	(OOPS: except what size.)
What is the expected run time of your solution for a size of n?  Predict 
	what it will be for very large n.  (Larger than you can execute.)
Hard:  Suppose there is a pawn somewhere on the board.  How many queens can
	you place so that they don't attack each other (though they of course
	attack the pawn).  Note that here you may have two queens on the first
	row if they are on opposite sides of a pawn on that row.  
*/

