Skip to content

Commit

Permalink
used max threefold-highest in validate instead of move
Browse files Browse the repository at this point in the history
  • Loading branch information
honzi committed Nov 1, 2024
1 parent 1c388d6 commit f377891
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions js/chess.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,6 @@ function chess_move(args){

game['50-moves'] = validation['50-moves'];
game['en-passant'] = validation['en-passant'];
game['threefold-highest'] = Math.max(
game['threefold-highest'],
validation['threefold']
);
let piece = board[args['piece-y']][args['piece-x']];

board[args['piece-y']][args['piece-x']] = '';
Expand Down Expand Up @@ -606,7 +602,10 @@ function chess_validate(args){
}

game['threefold'][threefold_string]++;
game['threefold-highest'] = game['threefold'][threefold_string];
game['threefold-highest'] = Math.max(
game['threefold'][threefold_string],
game['threefold-highest']
);
}

return {
Expand Down

0 comments on commit f377891

Please sign in to comment.