programing rebuy in

This commit is contained in:
wzdwc
2020-04-29 08:20:10 +08:00
parent 2481f5f2d3
commit 4d85239fbb
16 changed files with 972 additions and 133 deletions
+5 -1
View File
@@ -6,6 +6,8 @@ export interface IPlayer {
nickName: string;
account: string;
socketId: string;
sit?: boolean;
reBuy: number;
}
export enum ECommand {
@@ -37,6 +39,7 @@ export class Player {
actionCommand: string = '';
type: string = EPlayerType.DEFAULT;
evPot: number = Infinity;
inPot: number = 0;
pokeStyle: string = '';
// commandRecord: Array<string> = [];
@@ -76,7 +79,7 @@ export class Player {
const command = commandArr[0];
const raiseSize = Number(commandArr[1]);
let size = 0;
if (command !== ECommand.ALL_IN
if ((command !== ECommand.ALL_IN && command !== ECommand.FOLD)
&& (prevSize > (this.counter + this.actionSize) || raiseSize > this.counter)) {
throw 'player: error action, overflow action size';
} else {
@@ -126,6 +129,7 @@ export class Player {
}
if (size > 0) {
this.counter -= size;
this.inPot += size;
}
this.actionSize += size;
return size;