Skip to content

Blake Rayvid

Menu
  • About
  • Portfolio
Menu

Java Elevator Simulator

Posted on July 1, 2026July 23, 2026 by Blake

This is an interactive elevator simulator written in Java with Swing graphics. Users can click the ▲ (up) and ▼ (down) buttons on each floor to spawn riders and call the elevator. When a rider enters the elevator, the user selects their destination floor via a pop-up panel. The program uses a scheduling algorithm called LOOK to fulfill passenger requests and direct the elevator.

🔗 View on GitHub

Demonstration of the elevator mechanics.

The Algorithm

At the heart of this simulation is the classic LOOK elevator algorithm. This approach mimics how real-world elevators operate—moving steadily in one direction to handle active requests and turning around only when the path ahead is completely clear. This algorithm is also used to schedule read/write operations within a spinning hard disk platter.

  • Finding a Starting Point: When the elevator is resting and empty, it identifies the closest call in the building to decide which way to start moving.
  • Setting the Travel Limits: The elevator looks ahead to find the furthest request in its path (such as the highest floor for DOWN calls) to establish its turnaround point.
  • Sweeping Along the Path: As the elevator travels, it stops to drop off riders and pick up waiting passengers who are traveling in that same direction, while cleanly bypassing anyone heading the opposite way.
  • Turning Around: Once the elevator finishes its current run and has no more requests ahead, it checks for passengers waiting behind it, reverses direction, and begins a new sweep.

Next Steps

  • Group Dispatching: Optimize multiple elevator scenario. Implement a coordination algorithm that assigns a new request to the elevator that can reach it quickest.
  • Bypassing When Full: Fully implement weight limit logic so a fully loaded elevator skips intermediate floor requests entirely instead of stopping and refusing to let people board.
  • Smooth Animations: Upgrade the visualizer to show the elevator cabin moving smoothly pixel-by-pixel, rather than jumping from floor to floor.
Tags: Java, Java-AWT, Java-Swing
Categories: Exploration, Interactive, Optimization

Post navigation

OCR Image Search →
← Deep Learning for Clothing Classification

Categories

  • Data Science
  • Exploration
  • Finance
  • Health
  • Interactive
  • Optimization
  • Utilities

Tags

D3.js Desmos Docker Express.js FFmpeg Flask Gemini API Google Maps API HTML/CSS/JS Java Java-AWT Java-Swing MATLAB Matplotlib Netlify NetworkX Next.js NLP Node.js NumPy P5.js Pandas Pillow PostgreSQL Python PyTorch QuantConnect Railway React.js Scikit-Learn SciPy TensorFlow Tesseract WeasyPrint YFinance API

© 2026 Blake Rayvid. All rights reserved.