proof of concept for min-max algorithm