GameBoard: ignore obvuisly bad moves

This commit is contained in:
djmil 2023-11-27 15:03:57 +01:00
parent 0e6e896851
commit b6b1358131

View File

@ -14,7 +14,10 @@ export default function GameBoard({ username, getGame, onStoneClick, onStoneMove
(cellId) => onStoneClick(game.uuid, cellId); (cellId) => onStoneClick(game.uuid, cellId);
const optionalOnStoneMove = (typeof onStoneMove !== 'function' || isPushing) ? null : const optionalOnStoneMove = (typeof onStoneMove !== 'function' || isPushing) ? null :
(move) => onStoneMove(game.uuid, move); (move) => {
if (move[0] !== move[1] && game.board[move[1]] === undefined)
onStoneMove(game.uuid, move)
};
return ( return (
<div className='GameBoard'> <div className='GameBoard'>