vue-chessboard
vue-chessboard copied to clipboard
How to chess online with socket.io
How to prevent the same player move white and black. ex: if orientation is white then can't move black Please help me.
Hi @truongtrungtinh That's an interesting problem. I think you can extend the component so you have more flexibility to configure the underline components (chess.js and chessground), then you have to validate which user is white and which is black and prevent the movement. Here is an example of how to extend the component to play against a random move computer https://github.com/vitogit/vue-chessboard#extended-component-play-vs-random-ai In your case I think you can have 2 methods, whitePlay, blackPlay and add a condition if the currentUser is white or black make the move otherwise just return