Class: CypherPokerAnalyzer

CypherPokerAnalyzer(game)

Monitors and analyzes a CypherPoker game (hand) for cryptographic correctness and ranks the completed hands of the game to determine the winner.

Constructor

new CypherPokerAnalyzer(game)

Creates a new instance.
Parameters:
Name Type Description
game CypherPokerGame The game instance with which this instance is to be associated. Event listeners are added to the CypherPokerGame instance at this time so the analyzer should usually be instantiated at the beginning of a new game (hand).
Source:

Members

(readonly) active

Properties:
Name Type Description
True Boolean if the instance is active (tracking game actions), false if not.
Source:

(readonly) allKeychainsCommitted

Properties:
Name Type Description
allKeychainsCommitted Boolean True when all players associated with the CypherPokerAnalyzer#game instance have committed an end-game keychain.
Source:

(readonly) analysis

Properties:
Name Type Description
analysis Object The partial or full analysis of the completed game.
Properties
Name Type Default Description
private Object Name/value pairs with each name matching a player private ID and value containing an array of their verified private CypherPokerCard instances.
public Array Array of verified public CypherPokerCard instances.
complete Boolean false Set to true when the hand has been fully validated as far as possible.
error Error null The analysis error object, if one exists.
Source:

(readonly) communityCards

Properties:
Name Type Description
communityCards Array An array of CypherPokerCard instances of the community cards reported by the final decryptors.
Source:

(readonly) cypherpoker

Properties:
Name Type Default Description
cypherpoker CypherPoker null The CypherPoker instance associated with CypherPokerAnalyzer#game.
Source:

cypherpoker

Properties:
Name Type Description
cypherpoker CypherPoker A reference to the CypherPokerAnalyzer#game's cypherpoker instance or null if none exists.
Source:

(readonly) deals

Properties:
Name Type Description
deals Object Contains name/value pairs with each name representing the source (dealing) private ID of the player and the associated value being an array of objects, each containing a fromPID private ID of the sender of the data, a type denoting the type of dealing operation ("select" or "decrypt"), the card values in a cards array, and a private property indicating whether the deal was for private / hole cards or for public / community ones. Each entry is stored in order of operation.
Source:

(readonly) deck

Properties:
Name Type Description
deck Array An array of named objects, with each array element storing an object representing a snapshot of the deck generation and encryption processes.
Source:

(readonly) game

Properties:
Name Type Default Description
game CypherPokerGame null The game instance associated with this analyzer, as set at instantiation time.
Source:

keychainCommitTimeout

Properties:
Name Type Default Description
keychainCommitTimeout Number 10000 The amount of time, in milliseconds, to wait at the end of a game for all players' keychains to be comitted before timing out.
Source:

(readonly) keychains

Properties:
Name Type Description
keychains Object Name/value pairs of player keychains with each name representing a player private ID and associated value being their keychain. The keychain is copied from the associated CypherPokerAnalayzer#game instance once a game completes.
Source:

(readonly) mappedDeck

Properties:
Name Type Description
Returns Array a copy of the mapped deck of the associated CypherPokerAnalyzer#game instance (the CypherPokerGame#cardDecksfaceup property), or an empty array if none exists.
Source:

players

Properties:
Name Type Description
Indexed Array list of {CypherPokerPlayer} instances copied from the associated CypherPokerAnalyzer#game instance.
Source:

(readonly) privateCards

Properties:
Name Type Default Description
privateCards Object {} An object of named arrays, with each array named using the private ID of the associated player and containing the CypherPokerCard instances of the decrypted private cards for that player.
Source:

table

Properties:
Name Type Description
A TableObject copy of the table associated with the CypherPokerAnalyzer#game instance.
Source:

Methods

getDealer() → {CypherPokerPlayer}

Returns the CypherPokerPlayer that is currently flagged as the dealer in the CypherPokerAnalyzer#players array.
Source:
Returns:
The CypherPokerPlayer instance that is flagged as a dealer. null is returned if no dealer is flagged.
Type
CypherPokerPlayer

getMappedCard(mapping) → {CypherPokerCard}

Returns a reference to a CypherPokerCard based on its mapping.
Parameters:
Name Type Description
mapping String The plaintext or face-up card mapping value to find.
Source:
Returns:
The matching card instance or null if none exists.
Type
CypherPokerCard

getPlayer(privateID) → {CypherPokerPlayer}

Returns a CypherPokerPlayer instance associated with the analyzer's game instance.
Parameters:
Name Type Description
privateID String The private ID of the player to return.
Source:
Returns:
The CypherPokerPlayer for the private ID associated with this instance. null is returned if no matching player private ID can be found.
Type
CypherPokerPlayer

getPlayers(includeKeychainsopt, includePasswordsopt) → {Object}

Returns a condensed array containing the copied properties of the CypherPokerAnalyzer#players array. Use the object returned by this function with JSON.stringify instead of using CypherPokerAnalyzer#players directly in order to prevent circular reference errors.
Parameters:
Name Type Attributes Default Description
includeKeychains Boolean <optional>
false If true, the CypherPokerPlayer#keychain array of each player will be included in the returned object.
includePasswords Boolean <optional>
false If true, the CypherPokerAccount#password property of each CypherPokerPlayer#account reference will be included with the returned object.
Source:
Returns:
The condensed players array associated with this instance's game reference.
Type
Object

Events

analyzed

The cards captured for an associated game have been fully analyzed. A successful analysis is usually followed by scoring.
Type:
  • Event
Properties:
Name Type Description
analyzer CypherPokerAnalyzer A reference to this instance.
analysis CypherPokerAnalyzer#analysis A reference to the current analysis. property.
Source:

analyzing

The cards captured for an associated game are about to be analyzed.
Type:
  • Event
Properties:
Name Type Description
analyzer CypherPokerAnalyzer A reference to this instance.
analysis CypherPokerAnalyzer#analysis A reference to the current analysis. property.
Source:

scored

The cards captured for an associated game have been scored and ranked (post analysis).
Type:
  • Event
Properties:
Name Type Description
analyzer CypherPokerAnalyzer A reference to this instance.
analysis CypherPokerAnalyzer#analysis A reference to the current analysis. property.
Source: