-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMediocreStrategy.cpp
More file actions
21 lines (20 loc) · 868 Bytes
/
Copy pathMediocreStrategy.cpp
File metadata and controls
21 lines (20 loc) · 868 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include "MediocreStrategy.h"
//-----------------------------------------------------------------------------------------------//
void MediocreStrategy::strategyMove(const Board& board, vector<Ghost>& ghosts, const Point& p_packman)
{
if (RandomStrategy::getCountSteps() == (getAmountSameDir() * ghosts.size()))
{
SmartStrategy::setCountSteps(0);
RandomStrategy::setCountSteps(0);
amountSameSmartDir = (15 + rand() % 11); // change the amount steps of smart ghost
}
if (SmartStrategy::getCountSteps() < (amountSameSmartDir * ghosts.size()))
{
SmartStrategy::strategyMove(board, ghosts, p_packman);
}
else
{
RandomStrategy::strategyMove(board, ghosts, p_packman);
}
}
//-----------------------------------------------------------------------------------------------//