refactor checking of invalid moves such that it can be used without exceptions in strategies