Skip to content

Commit

Permalink
support initialFen and remove filter from soundMove.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
schlawg committed Nov 22, 2024
1 parent fc77f1e commit cd79197
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
1 change: 0 additions & 1 deletion ui/bits/src/bits.soundMove.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ export async function initModule(): Promise<SoundMove> {
await Promise.all(promises);

return o => {
if (o?.filter === 'game') return;
const volume = o?.volume ?? 1;
if (o?.san && o.uci) {
const pitch = keyToPitch(o.uci.slice(2));
Expand Down
7 changes: 6 additions & 1 deletion ui/round/src/ctrl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,12 @@ export default class RoundController implements MoveRootCtrl {
atomic.capture(this, dest);
return;
}
const san = sanOf(readFen(this.stepAt(this.ply - 1).fen), orig + dest);
const fen =
this.ply === 0
? (this.data.game.initialFen ?? 'rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR')
: this.stepAt(this.ply - 1).fen;
const san = sanOf(readFen(fen), orig + dest);

site.sound.move({ san, uci: orig + dest });
site.sound.saySan(san);
};
Expand Down

0 comments on commit cd79197

Please sign in to comment.