Skip to content

Instantly share code, notes, and snippets.

@BhaveshSGupta
Last active September 16, 2019 13:16
Show Gist options
  • Save BhaveshSGupta/0ba18977a890dddba24908e76cbd614e to your computer and use it in GitHub Desktop.
Save BhaveshSGupta/0ba18977a890dddba24908e76cbd614e to your computer and use it in GitHub Desktop.
var ticket = [{
name: 'tick585',
numbers: [
[5, 0, 20, 0, 45, 0, 60, 76, 0],
[0, 14, 26, 0, 49, 0, 64, 0, 88],
[0, 17, 0, 35, 0, 56, 0, 79, 90]
]
},
{
name: 'tick578',
numbers: [
[5, 0, 26, 0, 46, 0, 0, 76, 80],
[0, 15, 0, 30, 0, 53, 60, 0, 84],
[8, 17, 0, 35, 0, 59, 0, 79, 0]
]
}, {
name: 'tick577',
numbers: [
[0, 14, 20, 0, 43, 0, 69, 0, 81],
[3, 0, 0, 39, 0, 52, 0, 77, 83],
[0, 18, 27, 0, 48, 58, 0, 0, 89]
]
}, {
name: 'tick584',
numbers: [
[0, 10, 21, 0, 40, 0, 68, 0, 83],
[3, 12, 0, 32, 0, 55, 0, 71, 0],
[7, 0, 25, 38, 0, 59, 0, 75, 0]
]
}, {
name: 'tick579',
numbers: [
[2, 0, 23, 0, 40, 0, 63, 74, 0],
[0, 11, 0, 37, 0, 57, 66, 0, 86],
[9, 0, 24, 0, 45, 57, 0, 78, 0]
]
}, {
name: 'tick583',
numbers: [
[2, 0, 23, 31, 0, 51, 0, 70, 0],
[9, 0, 29, 0, 42, 0, 65, 0, 80],
[0, 19, 0, 37, 0, 54, 0, 73, 84]
]
}, {
name: 'tick580',
numbers: [
[0, 13, 0, 31, 47, 0, 67, 0, 85],
[0, 19, 0, 34, 0, 50, 0, 70, 90],
[1, 0, 25, 0, 49, 56, 0, 73, 0]
]
}, {
name: 'tick581',
numbers: [
[0, 12, 0, 32, 0, 54, 0, 72, 82],
[7, 0, 21, 36, 0, 0, 61, 0, 87],
[0, 16, 28, 0, 42, 0, 65, 75, 0]
]
}, {
name: 'tick582',
numbers: [
[0, 10, 0, 33, 41, 0, 62, 71, 0],
[4, 0, 22, 38, 0, 55, 64, 0, 0],
[6, 0, 29, 0, 44, 0, 68, 0, 88]
]
}, {
name: 'tick586',
numbers: [
[0, 15, 22, 0, 41, 0, 69, 0, 86],
[0, 18, 0, 39, 0, 50, 0, 72, 89],
[8, 0, 24, 0, 46, 53, 0, 74, 0]
]
}
]
var allNumbers = [0, 59, 51, 26, 48, 36, 16, 85, 58, 4, 34, 25, 12, 5, 54, 90, 43, 39, 89, 80, 46, 30, 9 ]
function house () {
ticket.forEach(function (i) {
var firstLine = i.numbers[0].filter(function (j) {
return allNumbers.includes(j)
})
if (firstLine.length === 9) {
console.log(i.name + ' can be claimed for first line')
}
var secondLine = i.numbers[1].filter(function (j) {
return allNumbers.includes(j)
})
if (secondLine.length === 9) {
console.log(i.name + ' can be claimed for second line')
}
var thirdLine = i.numbers[2].filter(function (j) {
return allNumbers.includes(j)
})
if (thirdLine.length === 9) {
console.log(i.name + ' can be claimed for third line')
}
if (thirdLine.length === 9 && secondLine.length === 9 && firstLine.length === 9) {
console.log(i.name + ' can be claimed for full house')
}
var greaterthen50T = i.numbers[2].filter(function (j) {
return j > 50
})
var greaterthen50S = i.numbers[1].filter(function (j) {
return j > 50
})
var greaterthen50F = i.numbers[0].filter(function (j) {
return j > 50
})
greaterthen50F.concat(greaterthen50S, greaterthen50T)
})
}
function all50andless () {
}
function all50above () {
}
house()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment