Skip to content

Commit 09f5a06

Browse files
author
linyisonger
committed
修复地图产生问题
1 parent 23d01ef commit 09f5a06

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

095.每日数独.html

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,7 @@
273273
tip = { x: [], y: [] }
274274
gridList = map.flat(1)
275275

276+
let isNull = false;
276277
for (let y = 0; y < 5; y++) {
277278
let yStr = ''
278279
let xStr = ''
@@ -281,11 +282,15 @@
281282
xStr += map[y][x].type
282283
}
283284

285+
if (xStr === '00000' || yStr === '00000') {
286+
isNull = true;
287+
break;
288+
}
284289
tip.y.push(yStr.split('0').filter(a => a).map(a => a.length))
285290
tip.x.push(xStr.split('0').filter(a => a).map(a => a.length))
286291
}
287292

288-
if (tip.y.length < 5 || tip.x.length < 5) { // 地图有问题重新生成
293+
if (tip.y.length < 5 || tip.x.length < 5 || isNull) { // 地图有问题重新生成
289294
initMap();
290295
return;
291296
}

0 commit comments

Comments
 (0)