Skip to content

Commit

Permalink
Fixed timer logic
Browse files Browse the repository at this point in the history
  • Loading branch information
hkirat committed Apr 22, 2024
1 parent 5ae05c0 commit e2ad6ce
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions apps/ws/src/Game.ts
Original file line number Diff line number Diff line change
Expand Up @@ -242,11 +242,12 @@ export class Game {
return;
}

if (this.board.turn() === 'w') {
// flipped because move has already happened
if (this.board.turn() === 'b') {
this.player1TimeConsumed = this.player1TimeConsumed + (moveTimestamp.getTime() - this.lastMoveTime.getTime());
}

if (this.board.turn() === 'b') {
if (this.board.turn() === 'w') {
this.player2TimeConsumed = this.player2TimeConsumed + (moveTimestamp.getTime() - this.lastMoveTime.getTime());
}

Expand Down

0 comments on commit e2ad6ce

Please sign in to comment.