Class: CypherPokerPlayer

CypherPokerPlayer(PID, playerInfoopt)

Stores and manages information for a player associated with a CypherPokerGame instance.

Constructor

new CypherPokerPlayer(PID, playerInfoopt)

Creates a new instance to track an individual player's information.
Parameters:
Name Type Attributes Default Description
PID String The private ID of the player to associate with this instance.
playerInfo Object <optional>
null Extended information for the player to associate with this instance.
Source:

Extends

Members

account

Properties:
Name Type Default Description
account CypherPokerAccount null The CypherPokerAccount instance associated with this player instance.
Source:

balance

Properties:
Name Type Default Description
balance BigInteger "0" The current in-game balance. Note that this is different than the CypherPokerAccount.balance property which reflects the total balance for the account.
Source:

dealtCards

Properties:
Name Type Description
dealtCards Array Indexed array of unencrypted or plaintext private CypherPokerCard instances that have been dealt to (selected by), the player.
Source:

hasBet

Properties:
Name Type Default Description
hasBet Boolean false True if the player has placed a bet or checked/called during the current round of betting, false if the player has not yet bet or if another player has raised.
Source:

hasFolded

Properties:
Name Type Default Description
hasFolded Boolean false True if the player has folded in this game (hand).
Source:

info

Properties:
Name Type Default Description
info Object null Additional information for the player as supplied during instantiation.
Source:

isBigBlind

Properties:
Name Type Default Description
isBigBlind Boolean false Set to true when the associated player becomes the big blind for the associated game.
Source:

isDealer

Properties:
Name Type Default Description
isDealer Boolean false Set to true when the associated player becomes the dealer for the associated game.
Source:

isSmallBlind

Properties:
Name Type Default Description
isSmallBlind Boolean false Set to true when the associated player becomes the small blind for the associated game.
Source:

(readonly) keychain

Properties:
Name Type Description
keychain Array Indexed array of keypair objects used by the player. These are stored in ascending order with index 0 being the newest keypair. For other players in a game, this array will typically remain empty until the end of the game (verification). After a game ends this array should be archived if needed as it is usually reset at the start of a new game (hand).
Source:

numActions

Properties:
Name Type Default Description
numActions numActions 0 The number of betting actions (bet or fold), comitted by the player.
Source:

privateID

Properties:
Name Type Description
privateID String The private ID of the player associated with this instance, as set at instantiation.
Source:

ready

Properties:
Name Type Default Description
ready Boolean false Set to true when the associated player has signalled that they're ready (their game instance has fully loaded and initialized).
Source:

selectedCards

Properties:
Name Type Description
selectedCards Array Indexed array of strings representing encrypted private cards dealt to (selected by), the player.
Source:

totalBet

Properties:
Name Type Description
totalBet BigInteger The total bet amount placed by the player in the current game (hand) in the smallest denomination of the target currency (e.g. Satoshis if using Bitcoin, pennies is using dollars, etc.) When setting this value, a Number or String may be used which will be cast to a BigInteger object.
Source:

Methods

addEventListener(type, listener, contextopt)

Registers a new event listener with the extending class instance.
Parameters:
Name Type Attributes Default Description
type String The event type to register.
listener function The listening function to invoke on the event.
context Object <optional>
null Unlike the traditional addEventListener parameter, this is the context or scope in which to invoke the listening function (since we can't use capture phases). If null, the listener is invoked in the context of the EventDispatcher or extending instance.
Inherited From:
Source:

copy() → {CypherPokerPlayer}

Creates a copy of this instance and returns that copy.
Source:
Returns:
A new player instance with the properties
Type
CypherPokerPlayer

getListeners(type) → {Array}

Returns all registered listeners for a specific event type.
Parameters:
Name Type Description
type String The event type to return registered listeners for.
Inherited From:
Source:
Returns:
A list of registered event listener objects for the specific event. Each object contains a listener function reference and an execution context reference.
Type
Array

removeEventListener(type, listener, contextopt)

Removes an event listener from the extending instance.
Parameters:
Name Type Attributes Default Description
type String The event type to remove the function from.
listener function The listening function to remove.
context Object <optional>
null The context or scope in which the listener exists.
Inherited From:
Source:

resetKeychain()

Irrevocably resets the keychain array (to an empty array).
Source:

toObject(includeKeychainopt, includeAccountPasswordopt) → {Object}

Returns a condensed data object containing the properties of this instance. Use the returned object to JSON.stringify instead of the instance directly as it contains circular references.
Parameters:
Name Type Attributes Default Description
includeKeychain Boolean <optional>
false If true, the keychain will be included with the returned data, otherwise if will be omitted.
includeAccountPassword Boolean <optional>
false If true, the password stored in the account reference will be included in the returned data, if available.
Source:
Returns:
The condensed data object containing copies of this instance's properties.
Type
Object