VERY general "minimax" functions