<?php
namespace Root\Core\Quantum;

class Collapse
{
    public static function pick(array $candidates, callable $scorer): mixed
    {
        $best = null;
        $score = null;
        foreach ($candidates as $k => $v) {
            $s = $scorer($v, $k);
            if ($score === null || $s > $score) {
                $best = $v; $score = $s;
            }
        }
        return $best;
    }
}
