OpenSpiel state methods: isplayernode

March 24, 2026 ยท View on GitHub

Back to Core API reference

is_player_node()

Returns True if the current state is a decision node where a single player acts (i.e. current_player() >= 0). Returns False for chance nodes, simultaneous nodes, mean field nodes, and terminal states.

Examples:

import pyspiel

game = pyspiel.load_game("tic_tac_toe")
state = game.new_initial_state()
print(state.is_player_node())      # Output: True
print(state.is_chance_node())      # Output: False

game = pyspiel.load_game("leduc_poker")
state = game.new_initial_state()
print(state.is_player_node())      # Output: False (initial state is a chance node)
print(state.is_chance_node())      # Output: True