From 70632680eb47987ab81a0fa8fd06e2ae3ff44fae Mon Sep 17 00:00:00 2001 From: Aaron Smith Date: Thu, 15 Feb 2024 07:20:14 -0700 Subject: [PATCH] split pot if you share the same straight --- js/functionality.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/js/functionality.js b/js/functionality.js index b11e7c7..316f3ae 100644 --- a/js/functionality.js +++ b/js/functionality.js @@ -433,6 +433,13 @@ function evaluateHand(iteration, gameStep) { if (winningHand === 4) {/*determine who has the highest straight */ topHand = Math.max(...playerStraightHighCard); + + if (getOccurrence(playerStraightHighCard, topHand) > 1 && playerStraightHighCard[0] === topHand) { + youWin("split"); + showPlayersCards(); + return false; + } + } if (winningHand === 2) { /* If the 2 winning players have two pair, who has the best 2 pair?*/ let allPairs = [...plyr1Pair, ...plyr2Pair, ...plyr3Pair, ...plyr4Pair];