数独ジェネレーターを実行しているときに、27回スタックオーバーフローが発生した後。
void start(int todel){
int number;
for (int x=0; x<9; x++) {
for (int y=0; y<9; y++) {
number = GenN(x, y);
osudoku[x][y]=number;
}
}
replace(todel);
output();
}
int GenZ(int x, int y){
int number;
bool duplication = true;
Randomize();
number = Random(9)+1;
duplication = check(number,x,y);
if (duplication==true){
return GenZ(x,y);
}
else if (duplication==false) {
return number;
}
}
私はこのコードでそれが何かだと思います。次のようなものを生成します。
758 431 629
913 267 485
642 985 317
Stack Overflow
だから私は1/3数独を手に入れます。