Skip to content

Commit

Permalink
add block 10 11
Browse files Browse the repository at this point in the history
  • Loading branch information
CmdBlockZQG committed Sep 26, 2023
1 parent adc53ac commit 05d905b
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 8 deletions.
42 changes: 37 additions & 5 deletions calc.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,33 @@ const blocks = [
[
[9]
]
],
[
[
[10, 10]
],
[
[10],
[10]
]
],
[
[
[11, 11],
[11, 0],
],
[
[11, 11],
[0, 11],
],
[
[0, 11],
[11, 11],
],
[
[11, 0],
[11, 11],
],
]
];

Expand Down Expand Up @@ -164,23 +191,28 @@ function dfs(p) {
x[i] = a[i].map(x => x);
}
res.push(x);
return;
if (res.length >= 10000) {
alert('方案数太多,仅计算前一万种。减少一些方块吧~');
return true;
}
return false;
}
const x = Math.floor(p / n), y = p % n;
if (a[x][y] !== -1) {
dfs(p + 1);
return;
if (dfs(p + 1)) return true;
return false;
}
for (let b = 0; b < 9; ++b) {
for (let b = 0; b < blocks.length; ++b) {
if (!l[b]) continue;
for (let d = 0; d < blocks[b].length; ++d) {
if (!canPlaceBlock(x, y, b, d)) continue;
placeBlock(x, y, b, d, b + 1);
--l[b];
dfs(p + 1);
if (dfs(p + 1)) return true;
++l[b];
placeBlock(x, y, b, d, -1);
}
}
return false;
}

2 changes: 1 addition & 1 deletion calc.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,10 @@
row: 5,
col: 6,
board: [],
num: [0, 0, 0, 0, 0, 0, 0, 0, 0],
num: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
res: false,
now: 0,
color: ['white', '#75C0FF', '#3B66CF', '#78ACC5', '#C8FAFD', '#FDFF00', '#4BFF00', '#FF9800', '#B9B24B', '#FF00AE']
color: ['white', '#75C0FF', '#3B66CF', '#78ACC5', '#C8FAFD', '#FDFF00', '#4BFF00', '#FF9800', '#B9B24B', '#FF00AE', '#8A2BE2', '#FF00FF']
}
},
methods: {
Expand Down

0 comments on commit 05d905b

Please sign in to comment.