summaryrefslogtreecommitdiff
path: root/src/engine/moves.js
diff options
context:
space:
mode:
authornil <niljo@airmail.cc>2024-12-13 16:42:57 +0100
committernil <niljo@airmail.cc>2024-12-13 16:42:57 +0100
commitcec1da14708e782801d0cc27fb13ff7586c0e96c (patch)
treeccd80c58e0aba22facb937c88ec5c9957055e4a1 /src/engine/moves.js
parent16e02376e2273eeb25a6461f84641e96a485f652 (diff)
liberty check demo
Diffstat (limited to 'src/engine/moves.js')
-rw-r--r--src/engine/moves.js8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/engine/moves.js b/src/engine/moves.js
index f820f97..26158a0 100644
--- a/src/engine/moves.js
+++ b/src/engine/moves.js
@@ -1,11 +1,17 @@
import { board } from "../board.js"
+import { hasLiberties } from "./liberty.js"
export function isMoveLegal({
position,
- turn = "none"
+ team = "none"
}) {
if (board.stones[position.y][position.x] != undefined) {
return false
}
+
+ if (!hasLiberties({position: position, team: team})) {
+ return false
+ }
+
return true
}