add isInvalidMove() function (minor refactoring)