simplified isValid method from MoveValidator to reduce cyclomatic complexity.