Add elevator module: State-pattern car (idle, moving, doors open, maintenance), LOOK stop rule, round-robin / nearest-car / ETA dispatchers, tick simulation on seeded traffic (8 test classes, 13 transcripts)

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017ic4b6W3VPEBweaeA5DE4n
This commit is contained in:
Claude
2026-11-18 21:11:10 +05:30
parent 05f41a3ef7
commit 4180e746ef
48 changed files with 1665 additions and 0 deletions
+18
View File
@@ -0,0 +1,18 @@
Taking car0 out of service while it carries a passenger
=======================================================
t=5: maintenance requested for car0, which is carrying 'a' to floor 5
t=05 car0 floor 2 MOVING_UP UP stops [5] riders [a(0->5)] | car1 floor 8 MOVING_DOWN DOWN stops [2u] riders []
t=06 car0 floor 3 MOVING_UP UP stops [5] riders [a(0->5)] | car1 floor 7 MOVING_DOWN DOWN stops [2u] riders []
t=07 car0 floor 4 MOVING_UP UP stops [5] riders [a(0->5)] | car1 floor 6 MOVING_DOWN DOWN stops [2u] riders []
t=08 car0 floor 5 DOORS_OPEN UP stops [] riders [] | car1 floor 5 MOVING_DOWN DOWN stops [2u] riders []
t=09 car0 floor 5 DOORS_OPEN UP stops [] riders [] | car1 floor 4 MOVING_DOWN DOWN stops [2u] riders []
t=10 car0 floor 5 DOORS_OPEN UP stops [] riders [] | car1 floor 3 MOVING_DOWN DOWN stops [2u] riders []
t=11 car0 floor 5 IDLE NONE stops [] riders [] | car1 floor 2 DOORS_OPEN UP stops [6] riders [b(2->6)]
t=12 car0 floor 5 MAINTENANCE NONE stops [] riders [] | car1 floor 2 DOORS_OPEN UP stops [6] riders [b(2->6)]
car0 entered MAINTENANCE at tick 12 at floor 5
hall call for 'b' went to: t=5 hall 2u -> car1 (at 9 IDLE)
after returnToService(): car0 floor 5 DOORS_OPEN UP stops [9] riders [c(5->9)]