You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

25 lines
449 B

3 weeks ago
/** 格子坐标 */
export interface Cell {
/** 行 */
row: number;
/** 列 */
col: number;
}
/**
* @param c 格子坐标
* @returns 唯一键字符串 "row-col"
*/
export function cellKey(c: Cell): string {
return `${c.row}-${c.col}`;
}
/**
* @param a 格子 A
* @param b 格子 B
* @returns 两格是否相同
*/
export function cellsEqual(a: Cell, b: Cell): boolean {
return a.row === b.row && a.col === b.col;
}