~jlonnber/tsim
and in the tsim installation package. To start tsim in Niksula, run
~jlonnber/tsim/tsim
<track>, where <track> is the track you want to load into tsim
(~jlonnber/tsim/track
contains the track used in this
assignment). In order to complete this task, you must:sync.Semaphore
s (see the sync
directory in the
tsim package or ~jlonnber/tsim/sync
in Niksula).
The trains must both
use the same code and base their
actions solely on sensor events and semaphore states. In particular, the train
ids should
not affect their behaviour.trains.Train
whose main
method starts a train thread for each of the two trains and drives them
from station to station as described above, when run in a virtual machine
whose standard output and input are connected to tsim. In other words, your
solution should start running (assuming Java is in the
path and your solution and the tsim package are in the current directory) on
Unix with the command:./2 "cd tsim-0.7; ./tsim
../track-sensors" "java
trains.Train"
~jlonnber/tsim/run
TSim.TSimInterface
.
Accidentally creating two of these is very likely to cause sensor
events to be lost.try_acquire
method in sync.Semaphore
will help you keep things running smoothly (or at least smoother).System.err
for debug
output. Sending
output to System.out
will confuse tsim.
trains/ |
The
Java (version 1.4 or earlier) source
code of your
train control program (the directory corresponds to the trains
package). |
track-sensors |
The
supplied track
with your
sensors added. |
description.pdf |
A
PDF containing
the
documentation for your solution. |
@students.hut.fi
.