summaryrefslogtreecommitdiff
path: root/src/engine/moves.js
blob: 26158a0ca0bcb3320a418dbd29c84337a6e050a2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import { board } from "../board.js"
import { hasLiberties } from "./liberty.js"

export function isMoveLegal({
    position,
    team = "none"
}) {
    if (board.stones[position.y][position.x] != undefined) {
	return false
    }

    if (!hasLiberties({position: position, team: team})) {
	return false
    }

    return true
}