Tie logic added

This commit is contained in:
2021-12-28 11:08:55 -03:00
parent 6d2f011c9b
commit 8a4aa970ee
3 changed files with 57 additions and 5 deletions

View File

@@ -1,7 +1,5 @@
export default function checkVictory(combinations, boxes) {
export default function checkVictory(combinations, boxes, globalBoxesMarked) {
const boxesSorted = boxes.sort()
const result = []
combinations.forEach(combination => {
@@ -11,8 +9,16 @@ export default function checkVictory(combinations, boxes) {
console.log('WIN')
result.push('WIN')
result.push(combination)
}
});
console.log(globalBoxesMarked.length)
if (globalBoxesMarked.length === 9 && result.length === 0) {
result.push('TIE')
}
return result
}