patch Game.makeMove with id

This commit is contained in:
sorrelbri 2020-07-12 13:36:00 -04:00
parent e95315053c
commit 6742d54aff

View file

@ -262,7 +262,7 @@ const Game = ({ gameData = {}, gameRecord = [] } = {}) => {
return { ...this, success: false }; return { ...this, success: false };
}, },
makeMove: function ({ player, pos: { x, y }, id }) { makeMove: function ({ player, pos: { x, y }, id, prior }) {
if (this.pass > 1) { if (this.pass > 1) {
return { ...this, success: false }; return { ...this, success: false };
} }
@ -286,7 +286,7 @@ const Game = ({ gameData = {}, gameRecord = [] } = {}) => {
const point = game.boardState[`${x}-${y}`]; const point = game.boardState[`${x}-${y}`];
game.pass = 0; game.pass = 0;
// allows for recording of prior move on game record // allows for recording of prior move on game record
game.addToRecord({ player, pos: { x, y }, id }); game.addToRecord({ player, pos: { x, y }, id, prior });
if (game.kos.length) helper.clearKo.call(game); if (game.kos.length) helper.clearKo.call(game);
point.makeMove(game); point.makeMove(game);
game.turn *= -1; game.turn *= -1;