forked from George-Britton/AI_Search_Algorithms
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathPlayer.h
More file actions
39 lines (32 loc) · 1.01 KB
/
Player.h
File metadata and controls
39 lines (32 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#pragma once
#include <vector>
// The player class holds the logic to traverse a map
class Player
{
public:
// Player constructor and destructor
Player() {};
~Player() {};
// This is the path the player takes through the grid
std::vector<int> Path;
// This is a FIFO queue
std::vector<int> FIFOQueue;
// This is a FILO stack
std::vector<int> FILOStack;
// Adds a cell to the chosen path
void AddCellToPath(int Index) { this->Path.push_back(Index); };
// FIFO
// Add to queue
void AddToFIFO(int Index) { this->FIFOQueue.push_back(Index); };
// Get from front of queue
int GetFIFO();
// Check if cell already in queue
bool bIsInQueue(int Index) { return std::find(FIFOQueue.begin(), FIFOQueue.end(), Index) != FIFOQueue.end(); }
// FILO
// Add to stack
void AddToFILO(int Index) { this->FILOStack.push_back(Index); };
// Get from top of stack
int GetFILO();
// Check if cell already in stack
bool bIsInStack(int Index) { return std::find(FILOStack.begin(), FILOStack.end(), Index) != FILOStack.end(); }
};