patch Game logic neighboring stone bug

This commit is contained in:
Sorrel Bri 2020-04-16 20:28:40 -07:00
parent a1f7c45536
commit 2c39fe1156
2 changed files with 9 additions and 1 deletions

View file

@ -228,7 +228,7 @@ class Point {
checkCapture = (Game) => {
let opps = this.checkNeighbors(Game).filter(nbr => nbr.stone === Game.turn * -1
&& nbr.getLiberties().every(liberty => liberty === this));
&& nbr.getLiberties(Game).every(liberty => liberty === this));
for (let opp of opps) {
if (opp.groupMembers.every(stone => stone.getLiberties().filter(liberty => liberty !== this).length === 0)) {
this.capturing = this.capturing.concat(opp.groupMembers);

View file

@ -28,6 +28,14 @@ describe('game services', () => {
}
})
it('game services places move next to stone', done => {
gameServices.initGame({ id: 1, handicap:4 });
const afterMoveOne = gameServices.makeMove({ id: 1 }, { player: 'white', pos: { x: 4, y: 3 } });
afterMoveOne.should.not.eql(fourHandicapBoard);
console.log (afterMoveOne)
done();
})
})