queens.h

来自「八皇后问题的一个程序」· C头文件 代码 · 共 29 行

H
29
字号
//FOR GLORY!
//MY HONOUR IS MY LIFE!
/*This implementation keeps arrays to remember which components
  of the chessboard are free or are guarded.*/
const int max_board=30;
int n=0;
class Queens{
public:
	Queens(int size);
	bool is_solved();
	void print()const;
	bool unguarded(int col)const;
	void insert(int col);
	void remove(int col);
	int board_size;

	int m;
	int count;
	void Queens :: solve_from(Queens &configuration);
    
  
private:
   bool col_free[max_board];
   bool upward_free[2 * max_board - 1];
   bool downward_free[2 * max_board - 1];
   int queen_in_row[max_board]; // column number of queen in each row
};

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?