#Traffic Simulation
The aim is to develop an application allowing to test crossing strategies for trains. A train is composed of vehicles attached one to each other by an immaterial link. Each vehicle has a starting point and a destination.
When two trains are crossing, they have to nor stop themselves neither bump into each other. The crossing has to be done thanks to spacing between vehicles.
When a vehicle alone (a train which has only one vehicle) bumps into a train, the vehicle alone and the bumped vehicle in the train are both destructed.
When a vehicle alone bumps into a train which has the same destination (or at least the next intermediate in its trip), it joins it.
The user has four options on the simulation:
- accelerate a vehicle (only possible if in a train which only contains this vehicle).
- decelerate a vehicle (only possible if in a train which only contains this vehicle).
- quit its train as soon as possible (at the next cross road, the vehicle has to quit its train, even if it means it has to take a way which does not allow it to reach its destination).
- switch color of the traffic lights.
####Authors:
Johann NOVAK ([email protected])
Quentin SCHULZ ([email protected])
####Usage:
- Continue the project
Clone the repository and directly import it in your favorite IDE (it was developed thanks to Eclipse, so it will work also with NetBeans).
- Take a look at the project
Download the .jar and all images at the root of this project and run it on your computer (the safest way to run the project is to import it in your IDE and export it to a .jar file instead of downloading it).
Next, set the .jar file executable: chmod +x TrafficSimulation.jar
Then run it with: java -jar TrafficSimulation.jar
#####Changelog
v0.1 - 2014-02-23
Initial release.
#####Bonus
####How to create a new map
Create a new .xml file wherever you want and follow the guides.
-
Creation of a new cross road:
<CrossRoad>
<Name>
C1</Name>
<PosX>
77</PosX>
<PosY>
20</PosY>
</CrossRoad>
-
Creation of a new road:
<Road>
<Starting_CrossRoad>
C1</Starting_CrossRoad>
<Ending_CrossRoad>
C3</Ending_CrossRoad>
</Road>
-
Creation of a new map:
<?xml version=”1.0“ encoding=”UTF-8“?>
<map>
<CrossRoad>
<Name>
C1</Name>
<PosX>
77</PosX>
<PosY>
20</PosY>
</CrossRoad>
<CrossRoad>
<Name>
C2</Name>
<PosX>
98</PosX>
<PosY>
63</PosY>
</CrossRoad>
<CrossRoad>
<Name>
C3</Name>
<PosX>
6</PosX>
<PosY>
150</PosY>
</CrossRoad>
<Road>
<Starting_CrossRoad>
C1</Starting_CrossRoad>
<Ending_CrossRoad>
C3</Ending_CrossRoad>
</Road>
<Road>
<Starting_CrossRoad>
C3</Starting_CrossRoad>
<Ending_CrossRoad>
C2</Ending_CrossRoad>
</Road>
</map>