build_default_win_function <- function(outcome_names) {
  function(treated_row, control_row) {
    y <- as.matrix(treated_row[, outcome_names], drop = FALSE)
    z <- as.matrix(control_row[, outcome_names], drop = FALSE)
    if (all(y == z)) {
      return(0) # Tie
    }
    result <- (y > z)[which.max(y != z)] * 1
    return(result)
  }
}


