八皇后问题动态演示_Qt5实现
1 //核心代码如下 2 //Queen--放置皇后 3 4 #include "queue.h" 5 6 queue::queue() 7 { 8 const int maxn = 9*9; 9 this->QN = 4; 10 this->board = new bool[maxn]; 11 for (int i = 0; i < maxn; i++) { 12 this->board[i] = false; 13 } 14 this->judgeRecursion = true; 15 this->count = 0; 16 } 17 18 queue::queue(int N) 19 { 20 const int maxn = 81; 21 if (N > 9 || N < 4) 22 this->QN = 4; //如果不合法就正规化棋盘 23