nightisyang / basic-poker

My first coding project. Fully featured Poker game. Vanilla JS, HTML, CSS.
0 stars 0 forks source link

Two pair conflict #17

Closed nightisyang closed 2 years ago

nightisyang commented 2 years ago

Reset! Press Initialize game to start! Initializing game 4 players initialized. Player 1 has 10 of Diamonds, King of Spades Player 2 has 7 of Clubs, 3 of Spades Player 3 has 6 of Diamonds, Jack of Diamonds Player 4 has 9 of Spades, Jack of Clubs Dealer has 6 of Hearts, Jack of Hearts, 4 of Spades Dealer has 6 of Hearts, Jack of Hearts, 4 of Spades, King of Diamonds. Dealer has 6 of Hearts, Jack of Hearts, 4 of Spades, King of Diamonds, 4 of Hearts Player 1 has Two pair and ranking of 7 Player 2 has Pair and ranking of 8 Player 3 has Two pair and ranking of 7 Player 4 has Two pair and ranking of 7

Player 1,Player 3,Player 4 are tied with Two pair Player 1 with 4 of Spades,4 of Hearts,King of Spades,King of Diamonds Player 3 with 6 of Diamonds,6 of Hearts,Jack of Diamonds,Jack of Hearts Player 4 with 4 of Spades,4 of Hearts,Jack of Clubs,Jack of HeartsThere's a stalemate between Player 1,Player 3. Done, lets play! Select number of players

Player 1 and Player 3 have same scores but Player 3 should win instead, king pair is higher than jack pair

nightisyang commented 2 years ago

Create a new condition, if duplicate hand ranks are found - see if there are two pairs. If it is two pairs

EDIT: if the highest pairs are the same, just compare the two pairs as a whole as per status quo