-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSimulation.h
More file actions
67 lines (59 loc) · 2.17 KB
/
Simulation.h
File metadata and controls
67 lines (59 loc) · 2.17 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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
/*---simulation.h--------------------------------------------------------------
* Thomas Matlak
*
* Simulation Class
*
* Operations:
* runSim() - Iterate through the simulation
* displayMap() - Display a representation of the map
* displayPlayers() - Display the information of the players in the simulation
* resetGraph() - Reset the graph to its starting state
*----------------------------------------------------------------------------*/
#pragma once
#include "Graph.h"
#include "Player.h"
#include <vector>
enum WhichAlgorithm: int {SELFISH = 0, OPTIMAL = 1};
class Simulation
{
public:
Simulation(int setNumPlayers, int setNumNodes, int setMaxEdgeLength);
~Simulation();
/*---runSim()--------------------------------------------------------------
* Iterate through the simulation using either the selfish or optimal
* version of the travelsal algorithm
*
* greedyOrOptimal - which version of the graph traversal to use
* Options are SELFISH or OPTIMAL
* Default is SELFISH
* pre: none
* post: he average travel time is returned
*------------------------------------------------------------------------*/
float runSim(WhichAlgorithm greedyOrOptimal = SELFISH);
/*---displayMap()----------------------------------------------------------
* Display information about the graph
*
* pre: none
* post: graph information is printed
*------------------------------------------------------------------------*/
void displayMap();
/*---displayPlayers()------------------------------------------------------
* Display the information of the players in the simulation
*
* pre: none
* post: player information is printed
*------------------------------------------------------------------------*/
void displayPlayers();
/*---resetGraph()----------------------------------------------------------
* Reset the graph to prepare to run the simulation again
*
* pre: none
* post: the graph is reset
*------------------------------------------------------------------------*/
void resetGraph();
private:
Graph *simMap;
std::vector<Player*> players;
std::vector<int> travelTimes;
int numPlayers;
};