Refactors method that calls minimax