提交 8f2de995 编写于 作者: U u014301111

Auto Commit

上级 4e660018
...@@ -4,7 +4,7 @@ import { is_empty, checkWin, is_black, is_white, robotPlay } from "./utils" ...@@ -4,7 +4,7 @@ import { is_empty, checkWin, is_black, is_white, robotPlay } from "./utils"
import RandomTree from "./components/RandomTree.vue"; import RandomTree from "./components/RandomTree.vue";
// import { robotPlay } from './utils/api' // import { robotPlay } from './utils/api'
// 配置 // 配置
const size = ref(30) const size = ref(20)
const win_size = ref(5) const win_size = ref(5)
// 棋盘 // 棋盘
const lattices = ref([]) const lattices = ref([])
...@@ -14,14 +14,19 @@ const records = ref([]) ...@@ -14,14 +14,19 @@ const records = ref([])
let isWin = [] let isWin = []
const time = ref(Date.now()) const time = ref(Date.now())
const records_obj = computed(() => { const records_obj = computed(() => {
return records.value.reduce((r, { location, type }) => { const obj = records.value.reduce((r, { location: [y, x], type }) => {
const [y, x] = location || []
const _win = isWin.map(([r, c]) => `${r}_${c}`).includes(`${y}_${x}`)
return { return {
...r, ...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) onMounted(confirm)
......
...@@ -62,9 +62,9 @@ input { ...@@ -62,9 +62,9 @@ input {
left: calc((20px - 20px * 0.9) * 0.5); left: calc((20px - 20px * 0.9) * 0.5);
box-shadow: box-shadow:
inset 1px 1px 1px rgba(0, 0, 0, 0.3), inset -1px -1px 1px rgba(0, 0, 0, 0.3),
inset -1px -1px 1px rgba(255, 255, 255, 0.7), inset 1px 1px 1px rgba(255, 255, 255, 0.7),
-2px -2px 2px rgba(0, 0, 0, 0.4); 2px 2px 2px rgba(0, 0, 0, 0.4);
} }
/* 竖线隐藏 */ /* 竖线隐藏 */
......
export const is_empty = 'isEmpty'; export const is_empty = 0;
/** /**
* 机器人 * 机器人
*/ */
export const is_white = 'isWhite'; export const is_white = 1;
export const is_black = 'isBlack'; export const is_black = 2;
/** /**
* [y, x] === [row, col] === [行,列] * [y, x] === [row, col] === [行,列]
*/ */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册