From 8f2de99592f1b912cac6af8b9fa3e88aecb66e9c Mon Sep 17 00:00:00 2001 From: u014301111 Date: Thu, 3 Aug 2023 14:17:22 +0800 Subject: [PATCH] Auto Commit --- src/App.vue | 15 ++++++++++----- src/assets/main.css | 6 +++--- src/utils/index.js | 6 +++--- 3 files changed, 16 insertions(+), 11 deletions(-) diff --git a/src/App.vue b/src/App.vue index dc15928..a7f4243 100644 --- a/src/App.vue +++ b/src/App.vue @@ -4,7 +4,7 @@ import { is_empty, checkWin, is_black, is_white, robotPlay } from "./utils" import RandomTree from "./components/RandomTree.vue"; // import { robotPlay } from './utils/api' // 配置 -const size = ref(30) +const size = ref(20) const win_size = ref(5) // 棋盘 const lattices = ref([]) @@ -14,14 +14,19 @@ const records = ref([]) let isWin = [] const time = ref(Date.now()) const records_obj = computed(() => { - return records.value.reduce((r, { location, type }) => { - const [y, x] = location || [] - const _win = isWin.map(([r, c]) => `${r}_${c}`).includes(`${y}_${x}`) + const obj = records.value.reduce((r, { location: [y, x], type }) => { return { ...r, - [`${y}_${x}`]: _win ? 'isWin' : type + [`${y}_${x}`]: type === is_black ? 'isBlack' : 'isWhite' } }, {}) + + if (isWin.length) { + isWin.map(([r, c]) => { + obj[`${r}_${c}`] = 'isWin' + }); + } + return obj }) onMounted(confirm) diff --git a/src/assets/main.css b/src/assets/main.css index bd39012..b700187 100644 --- a/src/assets/main.css +++ b/src/assets/main.css @@ -62,9 +62,9 @@ input { left: calc((20px - 20px * 0.9) * 0.5); box-shadow: - inset 1px 1px 1px rgba(0, 0, 0, 0.3), - inset -1px -1px 1px rgba(255, 255, 255, 0.7), - -2px -2px 2px rgba(0, 0, 0, 0.4); + inset -1px -1px 1px rgba(0, 0, 0, 0.3), + inset 1px 1px 1px rgba(255, 255, 255, 0.7), + 2px 2px 2px rgba(0, 0, 0, 0.4); } /* 竖线隐藏 */ diff --git a/src/utils/index.js b/src/utils/index.js index b3ffe7a..a928b12 100644 --- a/src/utils/index.js +++ b/src/utils/index.js @@ -1,9 +1,9 @@ -export const is_empty = 'isEmpty'; +export const is_empty = 0; /** * 机器人 */ -export const is_white = 'isWhite'; -export const is_black = 'isBlack'; +export const is_white = 1; +export const is_black = 2; /** * [y, x] === [row, col] === [行,列] */ -- GitLab