📄 board.h
字号:
// ****************************************************// Header file Board.h // ****************************************************#ifndef BOARD_H#define BOARD_H#include "Queen.h"#include <vector>#include <cassert>#include <iostream>using namespace std;static const int BOARD_SIZE = 8;class Board {public: Board(); // Supplies the Queen class with a pointer to the board. ~Board(); // Clears the board and removes pointer from queens. void clear(); // Clears board. void display() const; // Displays board. void doEightQueens(); // Initiates the Eight Queens problem. int getNumQueens() const; // Returns the number of queens on the board. const Queen *getQueen(int index) const; // Returns a pointer to the queen at the designated index. private: bool isQueen(int inRow, int inCol) const; // Determines whether there is a queen in position (inRow, inCol). bool placeQueens(Queen *queenPtr); // Attempts to place queens on board // starting with the designated queen. void removeQueen(); // Removes the last queen on the board, but does not delete it. void setQueen(const Queen *queenPtr); // Places a queen on the board. vector<const Queen *> queens; // array of queens on the board};#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -