Skip to main content

Function Reference

This page provides a comprehensive reference for all PQL functions available in Open PQL, organized by category.

Equity and Outcome Functions

equity

Returns the player's equity percentage (probability of winning + half probability of tying).

select equity from hero='AhKh', villain='QQ', game='holdem'
-- Result: ~43.0

wins_hi

Returns the probability of winning (excluding ties).

select wins_hi from hero='AhKh', villain='QQ', game='holdem'
-- Result: ~43.0

ties_hi

Returns the probability of tying.

select ties_hi from hero='AhKh', villain='QQ', game='holdem'
-- Result: ~0.0

scoops

Returns the probability of scooping in split-pot games.

select scoops from hero='AhKh', villain='QQ', game='holdem'
-- Result: ~43.0

Hand Analysis Functions

hand_type(street)

Returns the hand type (high card, pair, two pair, etc.) for the specified street.

Hand Types:

  • 'high_card'
  • 'pair'
  • 'two_pair'
  • 'three_of_a_kind'
  • 'straight'
  • 'flush'
  • 'full_house'
  • 'four_of_a_kind'
  • 'straight_flush'
select hand_type(flop) from hero='AhKh', board='AcKs2d', game='holdem'
-- Result: 'two_pair'

select hand_type(river) from hero='AhKh', game='holdem'
-- Result: varies by runout

exact_hand_type(street)

Returns the exact hand type with more specific categorization.

select exact_hand_type(flop) from hero='AhKh', board='AcKs2d', game='holdem'

hi_rating(street)

Returns a numerical hand strength rating.

select hi_rating(river) from hero='AhKh', villain='QQ', game='holdem'

best_hi_rating

Returns the best possible hand rating for the current context.

select best_hi_rating from hero='AhKh', board='AcKs2d', game='holdem'

hand_ranks(street)

Returns the ranks present in the player's hand.

select hand_ranks from hero='AhKh', game='holdem'
-- Result: rank set containing A and K

Board Analysis Functions

board_ranks(street)

Returns the ranks present on the board.

select board_ranks(flop) from board='AcKs2d', game='holdem'
-- Result: rank set containing A, K, and 2

board_suit_count(street)

Returns the number of different suits on the board.

select board_suit_count(flop) from board='AcKs2d', game='holdem'
-- Result: 3

select board_suit_count(flop) from board='AcKc2c', game='holdem'
-- Result: 1

paired_board(street)

Returns true if the board is paired.

select paired_board(flop) from board='AcAs2d', game='holdem'
-- Result: true

select paired_board(flop) from board='AcKs2d', game='holdem'
-- Result: false

straight_board(street)

Returns true if the board has straight potential.

select straight_board(flop) from board='9c8s7d', game='holdem'
-- Result: true

flushing_board(street)

Returns true if the board has flush potential (3+ cards of same suit).

select flushing_board(flop) from board='AcKc2c', game='holdem'
-- Result: true

monotone_board(street)

Returns true if all board cards are the same suit.

select monotone_board(flop) from board='AcKc2c', game='holdem'
-- Result: true

rainbow_board(street)

Returns true if all board cards are different suits.

select rainbow_board(flop) from board='AcKs2d', game='holdem'  
-- Result: true

twotone_board(street)

Returns true if the board has exactly two suits.

select twotone_board(flop) from board='AcKc2d', game='holdem'
-- Result: true

Rank Analysis Functions

max_rank(rank_set)

Returns the highest rank in a rank set.

select max_rank(board_ranks(flop)) from board='AcKs2d', game='holdem'
-- Result: 'A' (Ace)

min_rank(rank_set)

Returns the lowest rank in a rank set.

select min_rank(board_ranks(flop)) from board='AcKs2d', game='holdem'
-- Result: '2'

nth_rank(rank_set, n)

Returns the nth highest rank in a rank set.

select nth_rank(board_ranks(flop), 2) from board='AcKs2d', game='holdem'
-- Result: 'K' (second highest)

rank_count(rank_set)

Returns the number of ranks in a rank set.

select rank_count(board_ranks(flop)) from board='AcKs2d', game='holdem'
-- Result: 3

Range Functions

in_range(hand, range)

Returns true if the hand is contained in the specified range.

select in_range('AhKh', 'QQ+,AK') from game='holdem'
-- Result: true

select in_range('7h6s', 'QQ+,AK') from game='holdem'
-- Result: false

board_in_range(board, board_range)

Returns true if the board matches the board range specification.

select board_in_range(board, 'A**') from board='AcKs2d', game='holdem'
-- Result: true (board contains an Ace)

Draw and Outs Functions

outs_to_hand_type(street, target_hand_type)

Returns the number of outs to achieve the target hand type.

select outs_to_hand_type(turn, 'flush') from hero='As9s', board='2s3s7h', game='holdem'
-- Result: 9 (remaining spades)

outs_info

Returns detailed information about available outs.

select outs_info from hero='As9s', board='2s3s7h', game='holdem'

min_outs_to_hand_type(street, target_hand_type)

Returns the minimum number of outs needed across all players.

select min_outs_to_hand_type(turn, 'straight') from hero='JT', board='9-8-2', game='holdem'

Comparative Functions

overpair(street)

Returns true if the hand contains an overpair to the board.

select overpair(flop) from hero='KhKc', board='Qc9s2d', game='holdem'
-- Result: true

select overpair(flop) from hero='JhJc', board='Qc9s2d', game='holdem'
-- Result: false

pocket_pair

Returns true if the hand is a pocket pair.

select pocket_pair from hero='KhKc', game='holdem'
-- Result: true

select pocket_pair from hero='AhKc', game='holdem'
-- Result: false

has_top_board_rank(street)

Returns true if the hand contains the highest rank on the board.

select has_top_board_rank(flop) from hero='AhKc', board='Ac9s2d', game='holdem'
-- Result: true

has_second_board_rank(street)

Returns true if the hand contains the second highest rank on the board.

select has_second_board_rank(flop) from hero='9hKc', board='Ac9s2d', game='holdem'
-- Result: true

Advanced Analysis Functions

intersecting_hand_ranks

Returns ranks that appear in both hand and board.

select intersecting_hand_ranks from hero='AhKc', board='Ac9s2d', game='holdem'
-- Result: rank set containing A

nonintersecting_hand_ranks

Returns hand ranks that don't appear on the board.

select nonintersecting_hand_ranks from hero='AhKc', board='Ac9s2d', game='holdem'
-- Result: rank set containing K

duplicated_hand_ranks

Returns ranks that appear multiple times in the hand.

select duplicated_hand_ranks from hero='AhAc', game='holdem'
-- Result: rank set containing A

duplicated_board_ranks

Returns ranks that appear multiple times on the board.

select duplicated_board_ranks(flop) from board='AcAs2d', game='holdem'
-- Result: rank set containing A

Utility Functions

hand_board_intersections

Returns the number of cards that appear in both hand and board.

select hand_board_intersections from hero='AhKc', board='Ac9s2d', game='holdem'
-- Result: 1 (Ace appears in both)

three_flush(street)

Returns true if there are exactly 3 cards of the same suit on board.

select three_flush(flop) from board='AcKc2c', game='holdem'
-- Result: true

four_flush(street)

Returns true if there are exactly 4 cards of the same suit on board.

select four_flush(turn) from board='AcKc2c3c', game='holdem'
-- Result: true

Type Conversion Functions

to_card(string)

Converts a string to a card.

select to_card('Ah') from game='holdem'
-- Result: Ace of hearts

to_rank(string)

Converts a string to a rank.

select to_rank('A') from game='holdem'
-- Result: Ace rank

to_five_cards(hand, board, street)

Converts hand and board to best 5-card combination.

select to_five_cards(hero, board, river) from hero='AhKh', board='AcKs2d3h4c', game='holdem'

Streets

Functions that accept a street parameter can use:

  • preflop - Before any community cards
  • flop - After first 3 community cards
  • turn - After 4th community card
  • river - After 5th community card (final)

Usage Notes

  1. Street Parameters: Most board analysis functions require specifying which street (flop, turn, river) to analyze
  2. Hand Context: Hand analysis functions automatically use the current hand in the query context
  3. Game Types: All functions respect the specified game type ('holdem', 'shortdeck', etc.)
  4. Performance: Functions with board parameters are generally faster when the board is specified rather than averaged over all possibilities

For more examples of these functions in action, see the Examples page.