green all capture tests

This commit is contained in:
Sorrel Bri 2020-04-30 23:12:11 -07:00
parent 1a1e5121d7
commit e9d94d1fad
2 changed files with 14 additions and 14 deletions

View file

@ -197,7 +197,7 @@ const Game = ({gameData = {}, gameRecord = []} = {}) => ({
|| ( game.turn === -1 && player === 'white' );
if (isTurn) {
if (point.legal) {
game = point.makeMove(game);
point.makeMove(game);
game.turn *= -1;
success = true;
}

View file

@ -273,7 +273,7 @@ describe('makeMove group join and capture logic', () => {
done();
});
const multiCaptureGame = Game().initGame()
const multiCaptureGame = () => Game().initGame()
.makeMove({ player: 'black', pos: { x: 4, y: 17 } })
.makeMove({ player: 'white', pos: { x: 3, y: 16 } })
.makeMove({ player: 'black', pos: { x: 5, y: 16 } })
@ -290,26 +290,26 @@ describe('makeMove group join and capture logic', () => {
.makeMove({ player: 'black', pos: { x: 6, y: 3 } });
it('smoke test multi stone group capture', done => {
multiCaptureGame.makeMove({ player: 'white', pos: { x: 6, y: 16} })
multiCaptureGame().makeMove({ player: 'white', pos: { x: 6, y: 16} })
.success.should.eql(true);
done();
})
it('multi stone group full group is in capturing', done => {
const group = multiCaptureGame.boardState['5-16'].group;
console.log(multiCaptureGame.groups[group].liberties)
console.log(multiCaptureGame.boardState['4-16'].capturing)
multiCaptureGame.boardState['6-16'].capturing[-1][0].should.eql(group);
const game = multiCaptureGame()
const group = game.boardState['4-16'].group;
game.boardState['6-16'].capturing[-1][0].should.eql(group);
done();
})
// it('multi stone group capture all points are 0', done => {
// const boardState = multiCaptureGame.makeMove({ player: 'white', pos: { x: 6, y: 16} }).boardState;
// boardState['5-16'].stone.should.eql(0)
// // boardState['4-16'].stone.should.eql(0)
// // boardState['4-17'].stone.should.eql(0)
// done();
// })
it('multi stone group capture all points are 0', done => {
const game = multiCaptureGame();
game.makeMove({ player: 'white', pos: { x: 6, y: 16} });
game.boardState['5-16'].stone.should.eql(0)
game.boardState['4-16'].stone.should.eql(0)
game.boardState['4-17'].stone.should.eql(0)
done();
})
})