Skip to content

Commit

Permalink
fix: fix restart state
Browse files Browse the repository at this point in the history
  • Loading branch information
TheOnlyFastCoder2 committed Sep 6, 2024
1 parent 256f7c5 commit acb1884
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
8 changes: 5 additions & 3 deletions src/games/Matrix/logic.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,15 @@ export function checkMove (target, state) {
}
}


if(successes === state.sequence.curr) {
resault = "WIN";
}

if(fails >= getMaxFails(state.sequence.curr, state.maxFails)) {
resault = "LOSE";
}

if(successes === state.sequence.curr) {
resault = "WIN";
}

return resault;
}
2 changes: 1 addition & 1 deletion src/games/RandNum/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ export function Game () {

function restartGame(changedState) {
const newState = {
...logic.startData,
...state,
...changedState,
stateId: [Math.random()],
};
Expand Down
4 changes: 2 additions & 2 deletions src/games/RandNum/logic.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ export function checkСorrectness (variableVal, state) {
? "CORRECT"
: "INCORRECT"
);
console.log(state.fails ,state.quantity)

if(state.quantity === state.currentInd+1) {

res += "_"+(
state.fails+1 >= getMaxFails(state.quantity, state.maxFails)
state.fails >= getMaxFails(state.quantity, state.maxFails)
? "LOSE"
: "WIN"
)
Expand Down

0 comments on commit acb1884

Please sign in to comment.