The purpose of this exercise is to create an image in the example bellow:
The purpose of this exercise is to create an image like the example bellow:
![example](image.png)
![example](image.png)
@ -34,7 +34,7 @@ You are free to implement all the shapes with whatever internal structure you se
- `Line`: a new line should be created from references to two different points. Also it will define an associated function called `random`:
- `Line`: a new line should be created from references to two different points. Also it will define an associated function called `random`:
- `random`: receives two arguments, the first is the `maximum x` value a point can have and the second is the `maximum y` value that a point can have.
- `random`: receives two arguments, the first is the `maximum x` value a point can have and the second is the `maximum y` value that a point can have.
- `Triangle`: a new triangle should be created from references to three different points.
- `Triangle`: a new triangle should be created from references to three different points.
- `Rectangle`: a new rectangle should be created from two references to different points. ??????????????????????????????
- `Rectangle`: a new rectangle should be created from two references to different points.
- `Circle`: a new circle should be created from a point representing the center and an `i32` value representing the radius for the circle.
- `Circle`: a new circle should be created from a point representing the center and an `i32` value representing the radius for the circle.
- The main function also requires a definition of an associated function called `random` for the types `Line`, `Point` and `Circle`. You should derive their signature from the usage.
- The main function also requires a definition of an associated function called `random` for the types `Line`, `Point` and `Circle`. You should derive their signature from the usage.
@ -13,9 +13,11 @@ You must create an environment which contains all the objects described in this
1. Roads
1. Roads
There are various forms of intersections, let's focus on the widely seen four-lane intersection. For simplicity, each lane will have two directions.
There are various forms of intersections, let's focus on the widely seen four-lane crossroad. For simplicity, each road will have two lanes with two different directions for the total of two roads and four lanes.
```console
```console
lane1 lane2
| ↓ | ↑ |
| ↓ | ↑ |
| ↓ | ↑ |
| ↓ | ↑ |
| ↓ | ↑ |
| ↓ | ↑ |
@ -24,11 +26,11 @@ There are various forms of intersections, let's focus on the widely seen four-la
| r s l | ↑ |
| r s l | ↑ |
_______________| ← ↓ → | ↑ |_____________
_______________| ← ↓ → | ↑ |_____________
| ↑ r
| ↑ r
← ← ← ← ← ← ← | ← s ← ← ← ← ←
← ← ← ← ← ← ← | ← s ← ← ← ← ← lane3
| ↓ l
| ↓ l
_________________________|_______________________
_________________________|_______________________
l ↑ |
l ↑ |
→ → → → → s → | → → → → → →
→ → → → → s → | → → → → → → lane4
r ↓ |
r ↓ |
_______________ | _____________
_______________ | _____________
| | ← ↑ → |
| | ← ↑ → |
@ -53,7 +55,7 @@ it's usually green, red and amber, but for this project you will just use the co
You will then have to create some kind of representation for the traffic lights and distribute them for each lane in the intersection.
You will then have to create some kind of representation for the traffic lights and distribute them for each lane in the intersection.
You are free to decide what algorithm you want to implement to represent traffic light system, but keep in mind that traffic congestion should not be to high (8 or more vehicles).
You are free to decide what algorithm you want to implement to represent traffic light system, but keep in mind that traffic congestion should not be too high (8 or more vehicles).
3. Vehicles
3. Vehicles
@ -65,12 +67,9 @@ You are free to decide what algorithm you want to implement to represent traffic
Vehicles must obey this rules:
Vehicles must obey this rules:
- Vehicles must have a color depending on their route the colors are up to you to decide
- Vehicles must have a color so that it's possible to identify which route it will follow (ex:`r`- purple, `s`- Blue and `l`- Yellow). This information about the colors must be given to the auditor of the raid. The colors are up to you to decide.
- Vehicles must have a color so that it's possible to identify which route it will follow (ex:`r`- purple, `s`- Blue and `l`- Yellow). This information about the colors must be given to the auditor of the raid.
- Autonomous vehicles driving on a lane with a **given route** must follow the direction of
- Autonomous vehicles driving on a lane with a **given route** must follow the direction of that route, it is not possible for the autonomous vehicle to change lanes or routes.
that route, it's not possible for the driver to change lanes or routes.