diff options
author | nil <niljo@airmail.cc> | 2024-12-18 17:53:17 +0100 |
---|---|---|
committer | nil <niljo@airmail.cc> | 2024-12-18 17:53:17 +0100 |
commit | 2303968dc24664d1fb4383d019420e7ddcf06b8a (patch) | |
tree | dfd0193a6cc1178c193ed1c6ccce0c427cf4f0fd /src/engine/liberty.js | |
parent | 7b005bc02b1e73c71f8cb8f4e03b6fe6ff420c67 (diff) |
Diffstat (limited to 'src/engine/liberty.js')
-rw-r--r-- | src/engine/liberty.js | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/src/engine/liberty.js b/src/engine/liberty.js index 0947ab0..3af21e2 100644 --- a/src/engine/liberty.js +++ b/src/engine/liberty.js @@ -1,5 +1,5 @@ -import { board } from "../board.js" import { Vector2 } from "../engine/vector2.js" +import { getPiece } from "../engine/getPiece.js" import { PLAYER } from "../constants.js" const SURROUNDING = [ @@ -93,9 +93,7 @@ function getSurroundingGroups(position, team) { function getGroupSurroundingEnemies(group, playerTeam) { if (group.length == 0) return [] - let team = playerTeam == PLAYER.BLACK ? - PLAYER.WHITE : - PLAYER.BLACK + let team = PLAYER.OPPOSITE(playerTeam) let surroundingEnemies = group .map(p => getSurroundingGroups(p, team)) @@ -115,10 +113,6 @@ function getGroupSurroundingEnemies(group, playerTeam) { }) } -function getPiece(position) { - return board.stones[position.y][position.x] -} - function getSurroundingSquares(position) { return Array.from(SURROUNDING) .map(v => Vector2.sum(v, position)) |