refactoring minmax method...yields max move