added a function to check if the next computer  movement  is valid