score = (x) -> if x == "Yes" 10 else 0 weights = (1/3 for i in [0...3]) working_hours_fundamentals = [commitment, fair_overtime_commitment, commitment_in_business_relationship_employees] weights.reduce((weighted_sum, weight, index) -> weighted_sum + weight*score(working_hours_fundamentals[index]) , 0)