Skip to content

Commit 4df3436

Browse files
fix: fix bug in KNIGHT game
1 parent 36a0fcd commit 4df3436

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

src/games/Knight/index.jsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ export function Game () {
2020

2121
switch(result) {
2222
case "WIN":
23+
cell.classList.add("correct");
2324
transferFigure(featureMove);
2425
setNewState({...state,isWon: [true]});
2526
break;

src/games/Knight/logic.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export function getMovesWithState (cells, currentState) {
3737
export function checkMove(featureMove, currentState) {
3838
let {currentMove,moves,sequence} = currentState;
3939

40-
if(currentMove+1 === sequence.max) return 'WIN';
40+
if(currentMove === sequence.max) return 'WIN';
4141
else {
4242
return (
4343
moves[currentMove+1] === featureMove

0 commit comments

Comments
 (0)