diff options
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)) |