View this PageEdit this PageAttachments to this PageHistory of this PageHomeRecent ChangesSearch the SwikiHelp Guide
Hotspots: Admin Pages | Turn-in Site |
Current Links: Cases Final Project Summer 2007

Sp2000 Midterm Review: Simulate a Motorcycle

Review at Midterm Review - Sp2000.


How should I go about printing 'Putt!' and turning the wheel only once a second?

I am thinking that the run method brings some multi-processing into the picture. My run method will do what it does until the status variable of the engine is set to off. While run is executing, one should be able to change the status variable with another method. Once this variable is changed, run would discontinue. This would work right?

If I have a delay in my run method, will that halt other processes?


Multiple processes run in parallel, as do delays. Mark Guzdial



hmm...I did this twice. The first time I put the process making into the initialize instance method. It wouldn't work. The second time I did it, I made the process and started it in Engine run, and put the terminate message in Engine stop.

Why would one method work and not the other? Does it matter where you make the process ( init message or regular message )? or did I just not do something right the first time...?

Here's my messages and what class they belong to ( all instance methods ):
Engine:

Key:

Wheel:

Code:

midterm-review.st

Transcript code:

w _ Wheel new.
e _ Engine new.
k _ Key new.
e wheel: w.
k engine: e.

k insert. " starts the printing "
k remove. " stops the printing and kills the process "

I hope that is the correct design... plus it works :)

Uploading a fileIn would be easier to read...
good call....done



motorcyclesimulation.st is my version of the motorcyle simulation. Simply fileIn and look at Key example. I attempted a somewhat cleaner abstraction (I hope). Any feedback would be appreciated.
Matthew Wolenetz

Link to this Page