score = (x) -> if x == "Yes" 10 else 0 weights = [0.25, 0.25, 0.25, 0.25] ecosystem_restoration = [commitment, project_outcomes, time_bound_targets, project_outcomes_on_areas_beyond_own_operations] weights.reduce((weighted_sum, weight, index) -> weighted_sum + weight*score(ecosystem_restoration[index]) , 0)