Client side and server side javascript poker engine : manage players, get hands value, get winner, side pots management. Contact me if you need a working multiplayer server side nodejs version (nodejs/socket.io + benjaminrathelot javascript-poker-engine)
Can you improve this bet condition in more than one if ?
if(amount<=player.credits
&& (amount >= this.bigBlind || this.pot == 0 && this.currentHigh == 0 || player.currentBet == this.smallBlind && amount == this.smallBlind)
&& ((amount+player.currentBet)>=this.currentHigh || player.currentBet==-1 && (amount+player.currentBet+1)>=this.currentHigh || this.currentHigh==this.bigBlind && amount==this.smallBlind && player.currentBet==this.smallBlind))
Like
if(amount > player.credits) return 'Not enought credits';
if(amount < this.bigBlind) return 'The min amount is ' + this.bigBlind;
...
Hi,
Can you improve this bet condition in more than one if ? if(amount<=player.credits && (amount >= this.bigBlind || this.pot == 0 && this.currentHigh == 0 || player.currentBet == this.smallBlind && amount == this.smallBlind) && ((amount+player.currentBet)>=this.currentHigh || player.currentBet==-1 && (amount+player.currentBet+1)>=this.currentHigh || this.currentHigh==this.bigBlind && amount==this.smallBlind && player.currentBet==this.smallBlind))
Like if(amount > player.credits) return 'Not enought credits'; if(amount < this.bigBlind) return 'The min amount is ' + this.bigBlind; ...
I'm not good in poker to make that correctly :)
Thanks