Victory actions done

This commit is contained in:
2021-12-27 20:25:33 -03:00
parent 2a866751f9
commit 658c5b2419
8 changed files with 236 additions and 12 deletions

View File

@@ -1,13 +1,18 @@
export default function checkVictory(combinations, boxes) {
const boxesSorted = boxes.sort()
const result = []
combinations.forEach(combination => {
if (boxesSorted[0] === combination[0] && boxesSorted[1] === combination[1] && boxesSorted[2] === combination[2]) {
if (boxes.includes(combination[0]) && boxes.includes(combination[1]) && boxes.includes(combination[2])) {
alert('Win')
console.log('WIN')
result.push('WIN')
result.push(combination)
}
});
return result
}