2020-11-28 13:10:25 +00:00
|
|
|
#include "Pellets.hpp"
|
2021-06-16 11:59:16 +00:00
|
|
|
#include <algorithm>
|
2020-11-28 13:10:25 +00:00
|
|
|
|
2021-06-15 21:54:35 +00:00
|
|
|
Pellets::Pellets(const Board & board)
|
|
|
|
: positions(board.initialPelletPositions()) {}
|
2021-06-16 11:59:16 +00:00
|
|
|
|
|
|
|
bool Pellets::eatPelletAtPosition(Position p) {
|
|
|
|
auto it = std::find(positions.begin(), positions.end(), p);
|
|
|
|
if (it == positions.end())
|
|
|
|
return false;
|
|
|
|
positions.erase(it);
|
|
|
|
return true;
|
|
|
|
}
|