Skip to content

Commit

Permalink
Fix showdown functionality
Browse files Browse the repository at this point in the history
Only if both players have not folded there`s a showdown, otherwise none of the players hands are shown.
  • Loading branch information
todorm85 committed Nov 27, 2015
1 parent 2fcdb8e commit 93a6a4a
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions Source/TexasHoldem.Logic/GameMechanics/TwoPlayersHandLogic.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,15 +71,6 @@ public void Play()

this.DetermineWinnerAndAddPot(this.bettingLogic.Pot);

// showdown
foreach (var player in this.players)
{
if (player.PlayerMoney.InHand)
{
this.showdownCards.Add(player.Name, player.Cards);
}
}

foreach (var player in this.players)
{
player.EndHand(new EndHandContext(this.showdownCards));
Expand All @@ -95,6 +86,15 @@ private void DetermineWinnerAndAddPot(int pot)
}
else
{
// showdown
foreach (var player in this.players)
{
if (player.PlayerMoney.InHand)
{
this.showdownCards.Add(player.Name, player.Cards);
}
}

var betterHand = Helpers.CompareCards(
this.players[0].Cards.Concat(this.communityCards),
this.players[1].Cards.Concat(this.communityCards));
Expand Down

0 comments on commit 93a6a4a

Please sign in to comment.