Closed Swidjit closed 2 years ago
Hand.solve() seems to be working fine, but when trying to compare hands with Hand.winners(), I get the following error: 'h.qualifiesHigh is not a function'
console.log(hand1, hand2) // ['9h', '4s', '5s', 'Ts', '7d', 'Jh', 'Jc'] (7) ['9h', '4s', '5s', 'Ts', '7d', 'As', 'Ks']
console.log(hand1, hand2)
console.log(Hand.solve(hand1), Hand.solve(hand2)) // OnePair {cardPool: Array(7), cards: Array(5), suits: {…}, values: Array(11), wilds: Array(0), …} // Flush {cardPool: Array(7), cards: Array(5), suits: {…}, values: Array(14), wilds: Array(0), …}
console.log(Hand.solve(hand1), Hand.solve(hand2))
console.log(Hand.winners([hand1, hand2])) // TypeError: h.qualifiesHigh is not a function
console.log(Hand.winners([hand1, hand2]))
error seems to stem from the following lines of code
hands = hands.filter(function(h) { return h.qualifiesHigh(); });
Oops, I see what I was doing wrong - passing a raw hand array, rather than the results of Hand.solve(). My bad.
Hand.solve() seems to be working fine, but when trying to compare hands with Hand.winners(), I get the following error: 'h.qualifiesHigh is not a function'
console.log(hand1, hand2)
// ['9h', '4s', '5s', 'Ts', '7d', 'Jh', 'Jc'] (7) ['9h', '4s', '5s', 'Ts', '7d', 'As', 'Ks']console.log(Hand.solve(hand1), Hand.solve(hand2))
// OnePair {cardPool: Array(7), cards: Array(5), suits: {…}, values: Array(11), wilds: Array(0), …} // Flush {cardPool: Array(7), cards: Array(5), suits: {…}, values: Array(14), wilds: Array(0), …}console.log(Hand.winners([hand1, hand2]))
// TypeError: h.qualifiesHigh is not a functionerror seems to stem from the following lines of code