-
Notifications
You must be signed in to change notification settings - Fork 0
/
Simulation.h
55 lines (48 loc) · 1.77 KB
/
Simulation.h
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
#ifndef __SIMULATION_H__
#define __SIMULATION_H__
#include <iostream>
#include <fstream>
#include <vector>
#include "CarRandom.h"
#include "Animator.h"
#include "Car.h"
#include "Suv.h"
#include "Truck.h"
#include "VehicleBase.h"
using namespace std;
class Simulation{
private:
int seed;
int maximum_simulated_time;
int halfSize;
int green_north_south;
int yellow_north_south;
int green_east_west;
int yellow_east_west;
double prob_new_vehicle_southbound;
double prob_new_vehicle_northbound;
double prob_new_vehicle_eastbound;
double prob_new_vehicle_westbound;
double proportion_of_cars;
double proportion_of_SUVs;
double proportion_right_turn_cars;
double proportion_left_turn_cars;
double proportion_right_turn_SUVs;
double proportion_left_turn_SUVs;
double proportion_right_turn_trucks;
double proportion_left_turn_trucks;
CarRandom random = CarRandom(0);
void parseInput(string fileName);
void generateVehiclesNorthBound(vector<VehicleBase*> &northbound);
void generateVehiclesEastBound(vector<VehicleBase*> &eastbound);
void generateVehiclesSouthBound(vector<VehicleBase*> &southbound);
void generateVehiclesWestBound(vector<VehicleBase*> &westbound);
void updatePositionSecondHalf(vector<VehicleBase*> &road1, vector<VehicleBase*> &road2, int ticksTillRed);
void updatePositionIntersection(vector<VehicleBase*> &road1, vector<VehicleBase*> &road2, int ticksTillRed);
void updatePositionFirstHalf(vector<VehicleBase*> &road, int ticksTillRed);
public:
Simulation(string fileName, int seed);
~Simulation();
void runSim();
};
#endif