mirror of
https://github.com/FranP-code/Tic-Tac-Toe-Game.git
synced 2025-10-12 23:52:39 +00:00
18 lines
437 B
JavaScript
18 lines
437 B
JavaScript
export default function checkVictory(combinations, boxes) {
|
|
|
|
const boxesSorted = boxes.sort()
|
|
|
|
const result = []
|
|
|
|
combinations.forEach(combination => {
|
|
|
|
if (boxes.includes(combination[0]) && boxes.includes(combination[1]) && boxes.includes(combination[2])) {
|
|
|
|
console.log('WIN')
|
|
result.push('WIN')
|
|
result.push(combination)
|
|
}
|
|
});
|
|
|
|
return result
|
|
} |