wanisramdani / tramway

Process-based simulation in Java/JavaFX à la MVC (more like MVP actually)
1 stars 0 forks source link

Impossible to synchronize the model and view with only logic segments #16

Open djalilhebal opened 4 years ago

djalilhebal commented 4 years ago

Anchor points for trams (from 'A' to 'U') and for cars ('a' to 'd' and 'e' to 'h')

                                     [9:R]..[8:Y] (7:G)....[6:R]...  
                                                       |ed|       .  
                                                       |  |       .  
   R----------------K                N-----------------MfcL--K    .  
  /                  \              /                  |  |   J [5:Y]
 S                    \P          O/                   |  |   |      
 |                     C^^^^^^^^^^D                    |  |   |      
 T                    /            \                   |  |   |      
  \U                 /              \                  |  |   I      
   A----------------B                E-----------------FgbG--H       
                                                       |  |          
                                                       |ha|          
         [0:G]...[1:G]                [2:Y].......[3:R]....(4:G)     

Vehicles should execute different algorithms depending on their graphic segment (entering/leaving a logic segment):

CAR_GOING_NORTH_SEGMENTS = {
  0: a->b (enter)
  1: c->d (nothing)
  2: c->d (leave)
}

CAR_GOING_NORTH_SEGMENTS = {
  0: e->f (enter)
  1: f->g (nothing)
  2: g->h (leave)
}

TRAM_SEGMENTS = {
  0 : A, B, C (bridge::enter)
  0': C, D (bridge::leave)
  1 : D, E, F (intersection::enter)
  1': F, G (intersection::leave)
  2 : G, H, I, J, K, L (intersection::enter)
  2': L, M (intersection::leave)
  3 : M, N, O/D (bridge::enter)
  3': O/D, P/C (bridge::leave)
  4 : P, U/A (nothing)
}