extends Reference

class_name GameState

# var parent: GameState # possibly reference the previous state and only store changed cells

# cell state info
var cellOwners: Array

# line state info
var lineOwners: Array

func init_arrays(size: Vector2):
	var cells: int = int(size.x * size.y)
	# A grid graph G_(m,n) has mn nodes and (m-1)n+(n-1)m=2mn-m-n edges
	var lines: int = int((2 * size.x * size.y) - size.x - size.y)
	for _cell in range(cells):
		cellOwners.append(0)
	for _line in range(lines):
		lineOwners.append(0)

func clone() -> GameState:
	var ret = .new()
	ret.cellOwners = cellOwners.duplicate()
	ret.lineOwners = lineOwners.duplicate()
	return ret;
	
func get_cell_count():
	return cellOwners.size()
	
func get_line_count():
	return lineOwners.size()
