Show check(mate) indicators in moves list. No longer require the odd ?rid=... in...
[vchess.git] / client / src / utils / squareId.js
1 // Get the identifier of a HTML square from its numeric coordinates o.x,o.y.
2 export function getSquareId(o) {
3 // NOTE: a separator is required to allow any size of board
4 return "sq-" + o.x + "-" + o.y;
5 }
6
7 // Inverse function
8 export function getSquareFromId(id) {
9 const idParts = id.split("-");
10 return [parseInt(idParts[1]), parseInt(idParts[2])];
11 }