Skip to content

Commit

Permalink
golf castling san interpretation
Browse files Browse the repository at this point in the history
  • Loading branch information
allanjoseph98 committed Jan 25, 2025
1 parent 296c274 commit c6dc3fd
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions ui/nvui/src/chess.ts
Original file line number Diff line number Diff line change
Expand Up @@ -273,15 +273,8 @@ export const renderKey = (key: Key, style: MoveStyle): string =>
style === 'nato' || style === 'anna' ? `${renderFile(key[0] as Files, style)} ${key[1]}` : key;

export function castlingFlavours(input: string): string {
switch (input.toLowerCase().replace(/[-\s]+/g, '')) {
case 'oo':
case '00':
return 'o-o';
case 'ooo':
case '000':
return 'o-o-o';
}
return input;
const oos = input.split(/o|0/).length - 1;
return oos == 2 ? 'o-o' : oos == 3 ? 'o-o-o' : input;
}

/* Listen to interactions on the chessboard */
Expand Down

0 comments on commit c6dc3fd

Please sign in to comment.