Skip to content

Commit

Permalink
fix chessboard char
Browse files Browse the repository at this point in the history
  • Loading branch information
iFwu committed Oct 5, 2024
1 parent 4805f50 commit 560734b
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/chessboard/overlayCreation.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { PieceColor, PieceName, PieceType } from './types';

const pieceTypeToChineseChar: Record<PieceName, string> = {
'red_king': '帥', 'red_guard': '仕', 'red_bishop': '相', 'red_knight': '', 'red_rook': '', 'red_cannon': '炮', 'red_pawn': '兵',
'red_king': '帥', 'red_guard': '仕', 'red_bishop': '相', 'red_knight': '', 'red_rook': '', 'red_cannon': '炮', 'red_pawn': '兵',
'black_king': '将', 'black_guard': '士', 'black_bishop': '象', 'black_knight': '馬', 'black_rook': '車', 'black_cannon': '炮', 'black_pawn': '卒',
};

Expand Down
2 changes: 1 addition & 1 deletion src/components/ChessboardDisplay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const pieceMap: { [key: string]: string } = {
A: '仕',
B: '相',
N: '傌',
R: '',
R: '',
C: '炮',
P: '兵',
};
Expand Down
8 changes: 1 addition & 7 deletions src/components/SolutionDisplay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,7 @@ export function SolutionDisplay({
// Create move history items
const moveItems = moveHistory.map((move, index) => {
const fenBeforeMove = fenHistory[index]; // FEN before the move
let notation = '';
try {
notation = moveToChineseNotation(fenBeforeMove, move);
} catch (err) {
notation = 'Error';
console.error(`Error converting move to notation: ${err}`);
}
const notation = moveToChineseNotation(fenBeforeMove, move);
return (
<span key={index} className="move-item">
{notation}
Expand Down

0 comments on commit 560734b

Please sign in to comment.