pacman/lib/SuperPellets.cpp
2021-07-08 17:42:24 +02:00

17 lines
377 B
C++

#include "SuperPellets.hpp"
#include <algorithm>
namespace pacman {
SuperPellets::SuperPellets()
: positions(initialSuperPelletPositions()) {}
bool SuperPellets::eatPelletAtPosition(GridPosition p) {
auto it = std::find(positions.begin(), positions.end(), p);
if (it == positions.end())
return false;
positions.erase(it);
return true;
}
} // namespace pacman