13 lines
284 B
Text
13 lines
284 B
Text
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;
|
|
}
|