Legal moves function actually checks legality