summaryrefslogtreecommitdiff
path: root/src/engine/moves.js
blob: 694a4828a7695cfdb9b35c7363fd034946b209a5 (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
}