简单的消去游戏判断死锁算法,还有优化的余地. 用Qt做的消去游戏Demo 下载地址http://download.youkuaiyun.com/source/1922774 #include <iostream> #include <ctime> #include <cstdlib> using namespace std; const int BLOCKSIZE = 8; int mBlocks[8][8] = {{05, 10, 11, 9, 12, 16, 04, 00}, {19, 03, 15, 12, 07, 16, 18, 19}, {14, 9, 17, 9, 07, 10, 13, 9}, { 8, 04, 05, 16, 10, 16, 10, 16}, {04, 04, 00, 19, 17, 10, 06, 14}, {11, 02, 14, 13, 12, 10, 10, 11}, {12, 06, 10, 15, 03, 16, 19, 9}, {17, 8, 8, 06, 02, 03, 15, 8}}; //随即地图--->测试使用 void randomMap() { srand(time(0)); for (int i = 0; i < BLOCKSIZE; i++) for (int j &