Skip to content

feat: add traffic light sequencer lab prototype#1147

Open
AdityaSingh-18 wants to merge 7 commits intofreeCodeCamp:mainfrom
AdityaSingh-18:feat/add-traffic-light-sequencer-lab
Open

feat: add traffic light sequencer lab prototype#1147
AdityaSingh-18 wants to merge 7 commits intofreeCodeCamp:mainfrom
AdityaSingh-18:feat/add-traffic-light-sequencer-lab

Conversation

@AdityaSingh-18
Copy link
Contributor

Checklist:

Related to #66122

This PR is part of Naomi's JS Sprint.

@AdityaSingh-18 AdityaSingh-18 marked this pull request as ready for review March 3, 2026 18:27

5. You should log `"Switching to [color] for [duration]s"` to the console during each valid phase, where `[color]` and `[duration]` are the values from the current phase object.

6. You should detect durations less than equal to `0` within the phases and log `"Invalid phase detected"` and skip to the next phase using `continue`.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do you mean?

Suggested change
6. You should detect durations less than equal to `0` within the phases and log `"Invalid phase detected"` and skip to the next phase using `continue`.
6. You should detect durations less than or equal to `0` within the phases and log `"Invalid phase detected"` and skip to the next phase using `continue`.

Comment on lines +60 to +80
13. You should not make changes in the `config1`, `config2`, `config3`, and `config4` objects.

14. `runSequence(config1, 1)` should log `Switching to green for 5s`, `Switching to yellow for 2s`, `Switching to red for 4s` in order.

15. `runSequence(config1, 2)` should log `Switching to green for 5s`, `Switching to yellow for 2s`, `Switching to red for 4s`, `Switching to green for 5s`, `Switching to yellow for 2s`, `Switching to red for 4s` in order.

16. `runSequence(config2, 1)` should log `Switching to red for 3s`, `Invalid phase detected`, `Switching to green for 6s` in order.

17. `runSequence(config3, 3)` should log `Faulted phase!`.

18. `runSequence(config4, 5)` should log `No phase found`.

19. `generateTimeline(config1, 1)` should return `[5, 7, 11]`.

20. `generateTimeline(config1, 2)` should return `[5, 7, 11, 16, 18, 22]`.

21. `generateTimeline(config2, 2)` should return `[3, 1, 7, 10, 8, 14]`.

22. `generateTimeline(config3, 1)` should return `[5, 7, 13]`.

23. `generateTimeline(config4, 1)` should return `[]`.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these do not need to be user stories, but they are good hint text

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh yeah, thank you for the review.

I completely forgot about the hints part while making changes and added these in the user stories. I'll remove them.

@AdityaSingh-18 AdityaSingh-18 changed the title feat: add traffic light sequencer prototype feat: add traffic light sequencer lab prototype Mar 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants