-
Notifications
You must be signed in to change notification settings - Fork 450
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* docs(jraffic): add subject and auditfor jraffic raid * docs(Jart): add comprehension section in the audit * docs(Jraffic): add some comprehension questions refactor(Jraffic): change the question in the comprehension part
- Loading branch information
1 parent
78e9c18
commit b84f103
Showing
2 changed files
with
228 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
## Jraffic | ||
|
||
### Objectives | ||
|
||
Traffic congestion can be a major problem in urban areas. Your task is to create a traffic control strategy and visualize it with a simulation. The choice of library and file system is up to you. However, you might find the JavaFX library useful for creating GUI applications. | ||
|
||
### Instructions | ||
|
||
#### **Environment and Rules** | ||
|
||
You should create an environment that includes the objects specified in this section. The representation of the objects is entirely up to you. | ||
|
||
**1. Roads** | ||
|
||
Create two intersecting roads, each with a single lane in both directions. Traffic approaching the intersection can choose between : | ||
|
||
- going straight | ||
- turning left | ||
- turning right | ||
|
||
Below is a simple representation: | ||
|
||
```console | ||
North | ||
| ↓ | ↑ | | ||
| ↓ | ↑ | | ||
| | | | ||
| | | | ||
| | | | ||
| | | | ||
_______________| | |_______________ | ||
← ← ← ← | ||
East --------------- --------------- West | ||
→ → → → | ||
_______________ _______________ | ||
| | | | ||
| | | | ||
| | | | ||
| | | | ||
| | | | ||
| ↓ | ↑ | | ||
| ↓ | ↑ | | ||
South | ||
``` | ||
|
||
**2. Traffic Lights** | ||
|
||
Position traffic lights at the points where each lane enters the intersection. Your traffic lights should only have two colors: red and green. | ||
|
||
You can use any algorithm to control the traffic lights. However, the system should be efficient enough to avoid traffic congestion (8 or more vehicles). The primary aim of the traffic light system is to prevent collisions at the intersection. | ||
|
||
**3. Vehicles** | ||
|
||
``` | ||
______ | ||
/|_||_\`.__ | ||
=`-(_)--(_)-' | ||
``` | ||
The vehicles traveling through your capital city's new junction must follow these rules: | ||
|
||
- Vehicles must be painted in a color that illustrates the route they will follow. The colors are up to you to decide, and your choices will need to be made available during the audit of the raid. For example, all cars which make a right turn could be painted yellow. It's really up to you though. | ||
|
||
- It is not possible for the vehicle to change its selected route. | ||
|
||
- Each vehicle must have a fixed velocity. | ||
|
||
- A safety distance from other vehicles must be maintained. If one vehicle stops, the following vehicle must also stop before it gets too close to the stationary vehicle in front. | ||
|
||
- Vehicles must stop if the traffic light is red and proceed otherwise. | ||
|
||
- There are no other vehicle types with special privileges. You can consider that there are no emergency vehicles in your capital city. | ||
|
||
--- | ||
|
||
#### **Commands** | ||
|
||
You will use your keyboard to spawn vehicles for your simulation. You will use the arrow keys to spawn a vehicle on the appropriate side of the road, and with a random route. | ||
|
||
- **`↑` Up:** moves towards the intersection **from the south.** | ||
- **`↓` Down:** moves towards the intersection **from the north.** | ||
- **`→` Right:** moves towards the intersection **from the west.** | ||
- **`←` Left:** moves towards the intersection **from the east.** | ||
- **`r`:** moves towards the intersection **from a random direction.** | ||
- **`Esc` Escape:** ends the simulation. | ||
|
||
> It must not be possible to use the keyboard to spam the creation of vehicles; they must be created with a safe distance between them. | ||
> A safe distance is any distance which enables the vehicles to avoid crashing into each other. | ||
|
||
### Example | ||
|
||
You can see an example for road_intersection [here](https://www.youtube.com/watch?v=6B0-ZBET6mo). | ||
|
||
### Bonus | ||
You can implement the following optional features: | ||
|
||
- Vehicle and traffic light animations, and image rendering. You can find some cool assets here: | ||
|
||
- [limezu](https://limezu.itch.io/) | ||
- [finalbossblue](http://finalbossblues.com/timefantasy/free-graphics/). | ||
- [mobilegamegraphics](https://mobilegamegraphics.com/product-category/all_products/freestuff/). | ||
- [spriters-resource](https://www.spriters-resource.com/). | ||
|
||
### Notions | ||
- [JavaFX](https://openjfx.io/openjfx-docs/) | ||
- [Java KeyEvents](https://docs.oracle.com/javase/tutorial/uiswing/events/keylistener.html) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,121 @@ | ||
#### Comprehension | ||
|
||
***Is the student able to justify his choices and explain the following:*** | ||
***Note:*** Ask the student to show you the implementation in the source code when necessary. | ||
###### Can the student explain why he uses this library? | ||
|
||
###### Can the student explain how he manages the High-Traffic congestion | ||
|
||
###### Can the student explain he's choices about the color of the cars and their relation to routes | ||
|
||
###### Can the student explain how he animates the vehicles and the light traffic | ||
|
||
###### Can the student explain how he manages the key hooks? | ||
|
||
#### Functional | ||
|
||
##### Try to run the application. | ||
|
||
###### Does the application start? | ||
|
||
##### Try to generate a vehicle by pressing the `"Arrow Up"` key. | ||
|
||
###### Was a vehicle generated from the south, with a random route? | ||
|
||
##### Try to generate a vehicle by pressing the `"Arrow Down"` key. | ||
|
||
###### Was a vehicle generated from the north, with a random route? | ||
|
||
##### Try to generate a vehicle by pressing the `"Arrow Right"` key. | ||
|
||
###### Was a vehicle generated from the west, with a random route? | ||
|
||
##### Try to generate a vehicle by pressing the `"Arrow left"` key. | ||
|
||
###### Was a vehicle generated from the east, with a random route? | ||
|
||
##### Try pressing the `"r"` key. | ||
|
||
###### Was the vehicle generated from a random direction, with a random route? | ||
|
||
##### Try press the `"r"` key multiple times. | ||
|
||
###### Can you confirm that their no limit to the number of vehicles? | ||
|
||
##### Try pressing the `"r"` key more than 5 times to generate multiple vehicles, from multiple directions. | ||
|
||
###### Can you confirm that the vehicles were created and maintain a safe distance from one another? | ||
|
||
##### Try to generate three vehicles from the same direction. Do this for each of the four directions. | ||
|
||
###### Can you confirm that the vehicles were created and maintain a safe distance from one another? | ||
|
||
##### Try to generate two vehicles at the same time, one using the `"Up"` key and the other using the `"Down"` key (do this at least 3 times). | ||
|
||
###### Did all the vehicles pass through the intersection without any collisions? | ||
|
||
##### Try to generate two vehicles at the same time, one using the `"Right"` key and the other using the `"Left"` key (do this at least 3 times). | ||
|
||
###### Did all the vehicles pass through the intersection without any collisions? | ||
|
||
##### Try to generate two vehicles at the same time, one using the `"Up"` key and the other using the `"Left"` key (do this at least 3 times). | ||
|
||
###### Did all the vehicles pass through the intersection without any collisions? | ||
|
||
##### Try to generate two vehicles at the same time, one using the `"Up"` key and the other using the `"Right"` key (do this at least 3 times). | ||
|
||
###### Did all the vehicles pass through the intersection without any collisions? | ||
|
||
##### Try to generate two vehicles at the same time, one using the `"Down"` key and the other using the `"Left"` key (do this at least 3 times). | ||
|
||
###### Did all the vehicles pass through the intersection without any collisions? | ||
|
||
##### Try to generate two vehicles at the same time, one using the `"Down"` key and the other using the `"Right"` key (do this at least 3 times). | ||
|
||
###### Did all the vehicles pass through the intersection without any collisions? | ||
|
||
##### Try to generate five vehicles using the `"Up"` key, at the same time generate two vehicles using the `"Right"` key. | ||
|
||
###### Did all the vehicles pass through the intersection without any collisions? | ||
|
||
##### Try to generate one vehicle for all the lanes (do this at least 3 times). | ||
|
||
###### Did all the vehicles pass through the intersection without any collisions? | ||
|
||
##### Try to generate many vehicles randomly using the `"r"` key. Then wait for at least 1 min. | ||
|
||
###### Did all the vehicles pass through the intersection without any collisions? | ||
|
||
##### Try to generate many vehicles in lanes of your choice. | ||
|
||
###### Did all the vehicles pass through the intersection without any collisions? | ||
|
||
##### Try pressing the `"Esc"` key. | ||
|
||
###### Was the simulation ended? | ||
|
||
###### High traffic congestion is when there are 8 or more vehicles in the same lane without proceeding. Was there low traffic congestion while running the simulation? | ||
|
||
#### General | ||
|
||
###### Can you confirm that it is impossible to spam the creation of vehicles by pressing the arrow keys too many times or leave one pressed? | ||
|
||
##### Ask the captain of the raid to show you information about how the color of cars relates to its random route. | ||
|
||
###### Was the information about colors and routes available? | ||
|
||
###### Are vehicles assigned to their own route with an appropriate color? If so, do they obey that route? | ||
|
||
###### Do the vehicles keep a safe distance by avoiding a collision when the car in front stops? | ||
|
||
###### Do vehicles stop whenever there is a red light? | ||
|
||
###### Do vehicles proceed whenever there is a green light? | ||
|
||
#### Bonus | ||
|
||
###### +Is there any type of image sprite for a traffic light? (An image sprite is a collection of images put into a single image.) | ||
|
||
###### +Did the student implement some kind of animation and image sprite for the vehicle? | ||
|
||
###### +Did the student implement more features than those in the subject? |