extends Node2D
class_name Table

signal seat_clicked(Seat)

@onready var seat_1: Seat = $Seat1
@onready var seat_2: Seat = $Seat2
@onready var seat_3: Seat = $Seat3


# Called when the node enters the scene tree for the first time.
func _ready() -> void:
	pass # Replace with function body.


func on_seat_clicked(seat: Seat) -> void:
	seat_clicked.emit(seat)


func compute_score() -> float:
	var score_guest1 = seat_1.guest.compute_score([seat_2.guest, seat_3.guest]) if seat_1.guest != null else 0.0
	var score_guest2 = seat_2.guest.compute_score([seat_1.guest, seat_3.guest]) if seat_2.guest != null else 0.0
	var score_guest3 = seat_3.guest.compute_score([seat_1.guest, seat_2.guest]) if seat_3.guest != null else 0.0
	
	var table_score = score_guest1 + score_guest2 + score_guest3
	
	print("%s score: %s" % [name, table_score])
	return table_score
	
