minimax algorithm to move automatic player