2024-03-12 23:06:47 +00:00
|
|
|
#include <array>
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
namespace queens
|
|
|
|
{
|
|
|
|
// Easy way represent a conflict:
|
|
|
|
struct Conflict
|
|
|
|
{
|
|
|
|
int piece_1;
|
|
|
|
int piece_1_x;
|
|
|
|
int piece_1_y;
|
|
|
|
int piece_2;
|
|
|
|
int piece_2_x;
|
|
|
|
int piece_2_y;
|
|
|
|
};
|
|
|
|
class Piece
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
int x;
|
|
|
|
int y;
|
|
|
|
|
|
|
|
Piece(int x, int y);
|
|
|
|
};
|
|
|
|
class Queen: public Piece
|
|
|
|
{
|
|
|
|
using Piece::Piece;
|
|
|
|
};
|
|
|
|
|
|
|
|
class Board
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
int m;
|
|
|
|
int n;
|
|
|
|
};
|
|
|
|
|
|
|
|
class Configuration
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
int number_of_pieces;
|
|
|
|
std::vector<Piece> pieces;
|
|
|
|
Board* board;
|
|
|
|
|
|
|
|
Configuration(int m, int n, int number_of_pieces);
|
2024-03-13 00:52:23 +00:00
|
|
|
~Configuration();
|
|
|
|
|
|
|
|
// I could not get copy constructor and copy assignment operator to work :/
|
|
|
|
//Configuration(Configuration& t);
|
|
|
|
/*
|
|
|
|
|
|
|
|
Configuration& operator=(const Configuration& rhs)
|
|
|
|
{
|
|
|
|
this->board = rhs.board;
|
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
*/
|
2024-03-12 23:06:47 +00:00
|
|
|
std::vector<Conflict> get_conflicts();
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
}
|