Create is_valid_move_simple

This commit is contained in:
Patricia Aas 2021-10-19 10:08:41 +02:00 committed by GitHub
parent 653a0ff5bf
commit c981f127ed
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -0,0 +1,13 @@
bool PacManAI::isValidMove(const Move & move) {
const bool isOpposite = (move.direction == oppositeDirection(direction));
if (isOpposite) {
return false;
}
const bool canWalk = isWalkableForPacMan(move.position);
if (!canWalk) {
return false;
}
return true;
}