mirror of
https://github.com/FranP-code/Tic-Tac-Toe-Game.git
synced 2025-10-12 23:52:39 +00:00
Win game logic done
This commit is contained in:
13
script/game-functions/checkVictory.js
Normal file
13
script/game-functions/checkVictory.js
Normal file
@@ -0,0 +1,13 @@
|
||||
export default function checkVictory(combinations, boxes) {
|
||||
|
||||
combinations.forEach(combination => {
|
||||
|
||||
const boxesSorted = boxes.sort()
|
||||
|
||||
if (boxesSorted[0] === combination[0], boxesSorted[1] === combination[1], boxesSorted[2] === combination[2]) {
|
||||
|
||||
alert('Win')
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user