-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGameFlow.cpp
More file actions
171 lines (171 loc) · 5.02 KB
/
GameFlow.cpp
File metadata and controls
171 lines (171 loc) · 5.02 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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
////
//// Created by yarden95c on 08/12/16.
////
//
//#include "GameFlow.h"
//#include "Bfs.h"
//
//using namespace std;
//
///**
// * constractur of game flow.
// * @param map map of the city
// * @return nothing
// */
//GameFlow::GameFlow(Map *map) {
// grid = map;
// taxiCenter = new TaxiCenter();
//}
//
///**
// * destractur
// */
//GameFlow::~GameFlow() {
// delete (taxiCenter);
//}
//
///**
// * menu optinos of program
// */
//void GameFlow::startGame() {
// int choice;
// cin >> choice;
// while (choice != 7) {
// switch (choice) {
// case 1:
// this->insertDriver();
// break;
// case 2:
// this->insertARide();
// break;
// case 3:
// this->insertAVehicle();
// break;
// case 4:
// this->printDriverLocation();
// break;
// case 6:
// this->startDriving();
// break;
// default:
// break;
// }
// cin >> choice;
// }
//}
//
///**
// * insert a new driver to the list of driversInfo in the taxiCenter
// */
//void GameFlow::insertDriver() {
// int id, age, experience, cabId;
// Status status;
// char c, statusLetter;
// Driver *driver;
//
// cin >> id >> c >> age >> c >> statusLetter >> c >>
// experience >> c >> cabId;
// status = Status(statusLetter);
// driver = new Driver(grid, id, age, status, experience, cabId);
// taxiCenter->addDriverInfo(driver);
// driver = NULL;
// // set the pointer to point on null so when
// // the object will delete this pointer will no longer point on it
//}
//
///**
// * insert a new trip to the trips in the taxi center
// * trip doesn't have a driver yet, only in choice 6 we add a driver to
// * each trip
// */
//void GameFlow::insertARide() {
// int id, xStart, yStart, xEnd, yEnd, numOfPassengers;
// double tariff;
// char c;
// cin >> id >> c >> xStart >> c >> yStart >> c >> xEnd >> c >> yEnd >> c
// >> numOfPassengers >> c >> tariff;
// Point *start = new Point(xStart, yStart);
// Point *end = new Point(xEnd, yEnd);
// Trip *trip = new Trip(id, start, end, numOfPassengers, tariff);
// taxiCenter->addTrip(trip);
// start = NULL;
// end = NULL;
// trip = NULL;
// // set the pointers to point on null so when
// // the objects will delete those pointers will no longer point on them
//
//}
//
///**
// * insert a new vehicle to the cabs in the taxi center
// */
//void GameFlow::insertAVehicle() {
// int id, taxiType;
// char manufacturerLetter, colorLetter, c;
// Color color;
// CarType carType;
// cin >> id >> c >> taxiType >> c >> manufacturerLetter >> c >> colorLetter;
// color = Color(colorLetter);
// carType = CarType(manufacturerLetter);
// Cab *cab = new Cab(id, 0, carType, color);
// taxiCenter->addCab(cab);
// cab = NULL;
// // set the pointer to point on null so when
// // the object will delete this pointer will no longer point on it
//
//}
//
///**
// *printing the currrent location of a specific driver
// */
//void GameFlow::printDriverLocation() {
// vector<Driver *> v = taxiCenter->getDriversInfo();
// int driverId;
// cin >> driverId;
// for (vector<Driver *>::iterator it = v.begin(); it != v.end(); it++) {
// if ((*it)->getDriverId() == driverId) {
// cout << *((*it)->getCurrentLocation()) << endl;
// }
// }
//}
//
///**
// * set all the drivers to the closest trip and getting
// * allthe drivers to end point
// */
//void GameFlow::startDriving() {
// Bfs bfs(grid);
// vector<Trip *> trips = taxiCenter->getTrips();
// vector<Driver *> drivers = taxiCenter->getDriversInfo();
// for (vector<Trip *>::iterator it = trips.begin(); it != trips.end(); it++){
// Point *startLocation = (*it)->getStartPoint();
// int minSteps = 1000;
// for (vector<Driver *>::iterator itD = drivers.begin();
// itD != drivers.end(); itD++) {
// if ((*itD)->isAvailable()) {
// Point *driverLocation = (*itD)->getCurrentLocation();
// int numOfSteps = bfs.findNumOfSteps(startLocation,
// driverLocation);
// if (numOfSteps < minSteps) {
// minSteps = numOfSteps;
// (*it)->setDriver(*itD);
// }
// }
// }
// Point *end = (*it)->getEndPoint();
// Driver *driver = (*it)->getDriver();
// if(driver !=NULL) {
// driver->setCurrLocation(end);
// }
// end = NULL;
// driver = NULL;
// startLocation = NULL;
// // set the pointers to point on null so when
// // the objects will delete those pointers will no longer point on them
// }
// int sizeOfDrivers = drivers.size();
// while (sizeOfDrivers > 0) {
// taxiCenter->popTrip();
// sizeOfDrivers--;
// } //deleting the trip who has drivers and
//}