Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | 15x 15x 15x 15x 15x 15x 15x 15x 15x 15x 45x 45x 45x 16966x 16966x 45x 55x 9x 9x 55x 45x 5386x 5386x 5386x 45x 6210x 6210x 6210x 45x 11596x 11596x 45x 45x 45x 45x 45x 45x 15x 15x 15x 15x 15x 15x | function createColor(abbreviation, literal) { function getAbbreviation() { return abbreviation; } function getLiteral() { return literal; } function getOppositeColor() { if (isWhite()) return PieceColorEnum.Black; return PieceColorEnum.White; } function isWhite() { return isSameColor(PieceColorEnum.White); } function isEmpty() { return isSameColor(PieceColorEnum.Empty); } function isSameColor(color) { return literal === color.getLiteral(); } return { getAbbreviation, getLiteral, getOppositeColor, isWhite, isEmpty }; } const PieceColorEnum = Object.freeze({ White: createColor("W", "white"), Black: createColor("B", "black"), Empty: createColor("", "empty"), }); export { PieceColorEnum }; |