top of page

Code Snippets: Driver Distraction
Detection

In this section you are seeing three (3) code snippets generated for the driver distraction detection use case with high prompt difficulty

The human written code, the GenAI model 1 and GenAI model 2 generated code. 

Please, keep this window open while completing the questionnaire.

Prompt:

" Generate an asynchronous driver distraction detection application that dynamically adjusts vehicle behavior based on the driver's distraction level. The system should:

- Continuously monitor the distraction level and compare it against a predefined risk threshold.
- If the distraction level exceeds the threshold, turn on the hazard lights and set both left and right fan speeds to the maximum.
- If the distraction level is below the threshold, turn off the hazard lights and set both fan speeds to the minimum.
- Ensure that the system is non-blocking, with an asynchronous loop running at 1-second intervals.
- Use proper condition checks to avoid redundant actions (e.g., if the hazard lights are already on, don’t turn them on again)."

Human written code

GenAI model 1 code

GenAI model 2 code

bottom of page