⚠️ ACADEMIC ARCHIVE: This repository contains a university project from 2nd year. It is preserved intentionally to demonstrate "Spaghetti Code" patterns and my personal growth as a software engineer.Looking for clean architecture? Check out my recent work.
This project simulates a real-time traffic light control system using JavaFX. The system attempts to dynamically adjust traffic light durations based on vehicle density to reduce congestion.
While the project works visually, the codebase serves as a perfect example of Anti-Patterns (God Objects, Magic Numbers, etc.) rather than strict OOP/MVC adherence.
- Interactive Interface: A visual simulation of a four-way intersection built with JavaFX.
- Density-Based Logic: Traffic light timers adjust based on the number of waiting cars.
- User Controls:
- Manually input the number of cars for each lane.
- Random Mode: Let the system generate traffic scenarios.
- Pause/Resume: Control the flow of time.
- Java 21
- JavaFX 21
- Maven (Project Management)
- Ensure you have JDK 21 installed.
- Open the project in IntelliJ IDEA (Recommended) or Eclipse.
- Reload Maven project to download dependencies.
- Run
Application.javainsrc/main/java/org/example/projefx.
- Text Fields: Enter the number of cars for specific lanes.
- Random Button: Generates a random number of cars for all lanes automatically.
- Start Button: Begins the simulation. Cars will move when their respective light turns green.
- Pause Button: Pauses the simulation loop. Click again to resume.
- Reset Button: Clears all cars and timers, allowing you to start a fresh scenario.
- Akif Alan
- Efe Aksu
- Erkan Karahan
This project is archived for educational purposes.