jhlywa / chess.js

A TypeScript chess library for chess move generation/validation, piece placement/movement, and check/checkmate/draw detection
BSD 2-Clause "Simplified" License
3.57k stars 877 forks source link

Reversed board #461

Open mirik999 opened 1 month ago

mirik999 commented 1 month ago

Hello everyone, I did a multiplayer game in react native and i could not find any usefull info how to reverse the board for player two to see black pieces at bottom side . Manually board.reverse() does the job only visually , is there any ready to use function to do this or any guides ? Thank you.

mirik999 commented 1 month ago

with board.reverse() visually it reverse but actually chess.moves() dont know about it. from d7 to d6 for example const move = moves.find((m) => m.from === from && m.to === to); this return undefined beause chess.moves() shows that it can go from d2 to ... . Without reverse() the piece located at d2.