Refactored the getMove method and created an is_invalid_move method to do validity checks