poker-engine icon indicating copy to clipboard operation
poker-engine copied to clipboard

Problem with distributing pot to winners

Open sangyoo91 opened this issue 3 years ago • 5 comments

I found an error where when everyone folds, the pot goes to the highest hand even if the player has folded.

The pot should go to the one person who didnt fold .

table.winners shows the proper winner, but the chips go to the person with the actual highest hand

sangyoo91 avatar Mar 13 '21 06:03 sangyoo91

Upon looking further into this, I think table.showdown pots.eligiblePlayers doesn't consider player fold state.

sangyoo91 avatar Mar 13 '21 07:03 sangyoo91

I think this is fixed. Please test it out and if it still happens then bring me back some steps to reproduce and I'll tackle it :)

catdadcode avatar Jul 04 '21 02:07 catdadcode

I made my own fixes locally for this, but I'll test it out.

sangyoo91 avatar Jul 04 '21 22:07 sangyoo91

Mind sharing those fixes? :sweat_smile:

catdadcode avatar Jul 04 '21 23:07 catdadcode

I've strayed away from the project, but if I remember properly it was

 // Distribute pots and mark winners.
this.pots.forEach(pot => {
  pot.winners = findWinners(pot.eligiblePlayers); 
  const award = pot.amount / pot.winners!.length;
  pot.winners!.forEach(player => player.stackSize += award);
});

This part that was the problem.

I don't use type script but I believe I did

pot.winners = findWinners( pot.eligiblePlayers.filter((p)=> {
  return !p.folded
}) );

On a local js build I did. Hope this helps :D

sangyoo91 avatar Jul 13 '21 06:07 sangyoo91