I am working on Tic-Tac-Toe logic right now and I have my "victory lines" grouped together in Godot. I am trying to check if a variable, same name in all objects, is the same value. I am essentially using an array as a very simple state machine. The groups are called as arrays at start for the sake of mechanical clarity.
onready var myButtons = get_tree().get_nodes_in_group('all_buttons')
onready var row1 = get_tree().get_nodes_in_group('row_1')
onready var row2 = get_tree().get_nodes_in_group('row_2')
onready var row3 = get_tree().get_nodes_in_group('row_3')
onready var column1 = get_tree().get_nodes_in_group('column_1')
onready var column2 = get_tree().get_nodes_in_group('column_2')
onready var column3 = get_tree().get_nodes_in_group('column_3')
onready var across1 = get_tree().get_nodes_in_group('across_1')
onready var across2 = get_tree().get_nodes_in_group('across_2')
Each button node has a code like this:
var stateMachine = ["EMPTY", "HAS_X", "HAS_O"]
var state = stateMachine[0]
So my question:
How would I check this local "state" variable throughout the entire group at once with a method? Obviously I will check it in the Main Scene, I just need to know what process to use.