Skip to content

My 2nd-year university project. A perfect example of Spaghetti Code and what NOT to do in JavaFX. kept for educational purposes and nostalgia.

Notifications You must be signed in to change notification settings

garelme/Traffic-Sim-Spaghetti-Edition

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🚦 Traffic Simulation System (Legacy Edition)

⚠️ 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.

📝 Description

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.

🚀 Features

  • 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.

🛠️ Built With

  • Java 21
  • JavaFX 21
  • Maven (Project Management)

💻 How to Run

  1. Ensure you have JDK 21 installed.
  2. Open the project in IntelliJ IDEA (Recommended) or Eclipse.
  3. Reload Maven project to download dependencies.
  4. Run Application.java in src/main/java/org/example/projefx.

🎮 How to Use

  • 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.

👥 Contributors

  • Akif Alan
  • Efe Aksu
  • Erkan Karahan
image image

This project is archived for educational purposes.

About

My 2nd-year university project. A perfect example of Spaghetti Code and what NOT to do in JavaFX. kept for educational purposes and nostalgia.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages