Auto Commit

上级 483e543d
......@@ -27,12 +27,18 @@ onMounted(confirm)
function confirm() {
isWin = []
lattices.value = Array(size.value).fill([]).map(() => Array(size.value).fill(is_empty))
records.value = []
}
function back(){
Array(2)
function back() {
if (records.value.length < 2) return;
for (let i = 0; i < 2; i++) {
const { location: [y, x] } = records.value.pop()
lattices.value[y][x] = is_empty
}
isWin = []
}
function setPiece([y, x], type){
function setPiece([y, x], type) {
records.value.push({
location: [y, x],
type: type
......@@ -70,7 +76,7 @@ async function playChess(item, row, col) {
<label for="win_size" class="space-nowrap">胜利棋数:</label>
<input v-model="win_size" id="win_size" type="number" min="3" max="8">
</p>
<button @click="confirm" class="space-nowrap">重新开始</button>
<button @click="confirm" class="space-nowrap mr-6px">重新开始</button>
<button @click="back" class="space-nowrap">返回上一步</button>
</div>
<div class="content border-top content-lattice">
......
......@@ -12,8 +12,6 @@ body,
}
#app {
margin: 0 auto;
font-weight: normal;
cursor: pointer;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册