Move move validation logic to its own function. Call this function as a pre-condition for calculating next move