base minimax algorithm