Trains
Each train has a trainnumber. The trainnumber is for prioritization, when multiple trains compete for the same track. Lower numbers mean higher priorities, e.g. train 0 has the highest priority. Priorities can't be changed dynamicly.
Each train has one home-track at each station.
Train numbering
Variable trainNum is used to identify trains.
...
Use println function to produce textual output. Do not use printf or other io functions, because output may not be flushed correctly.
Tracks
Stopping on tracks without contacts is permitted. Therefore they must be reserved and used with an adjacent track.
Each station has one drive-through track for each possible direction:
station | track |
---|---|
IC_station | IC_ST_1 |
OC_station | OC_ST_3 |
KH_station | KH_ST_5 |
KH_station(r) | KH_ST_1 |
Codestyle
Use entry-/exit-actions instead of actions on transitions, if possible.
If using hostcode, only use functions delivered by our own C-Interface.
Mutual Exclusion
bool <track>_req[trainAmount] contains the requests for each track and train. Before the availability of arrays, we used bool <train>_<track>_req.
int <track>_perm contains the trainnumber of the train, who is allowed to drive on <track>.