cs533 Project 1
The Dog and the Mailman
Due date: Friday, February 6th, by 11:59pm
You are to simulate various scenarios involving dogs and mailmen (you can substitute mailwomen if you want your mail carriers to be a woman or mailpeople if you want your mail carriers to be gender neutral). Basically, a mailman comes to the walkway of a house. The dog and the mailman see each other and take action. The dog tries to catch the mailman (either to bite him or to get the dog biscuits he's carrying) and the mailman tries to get away.
y(t)) be the
position of a dog at time t (where distance is in feet and
t is in seconds, say). A mailman is located at position
(p(t), 0) and is moving in the positive x
direction. The dog always runs directly towards the mailman with a
s(t) beginning at
(x(0), y(0)) = (0, 20), and the dog was lying
s(0) = 0.
There are two types of dogs to consider:
s(t) = 2t for 0 < t < 5 s(t) = 10 for 5 <= t
s(trun) = 3trun for 0 < trun < 4 s(trun) = 12 for 4 <= trunwhere trun is the time since the dog last slipped and fell. To determine if the dog slips and falls, call the function slip(trun) at each time step of your simulation.
You are to write a simulation program to determine when each type of dog bites the mailman for two different types of mailmen (i.e. there are a total of four different cases to consider). Each mailman has an untied shoe at t=0.
Type-A mailmen stand still for 3 seconds to tie their shoe before running at a constant speed of 5.
Type-B mailmen leave their shoes untied and try to run with a loose shoe at half their normal speed (i.e. 2.5).
Determine which type of mailman runs the furthest before getting bitten by each type of dog by simulating each situation at least ten times.
You can (and probably should) seed your random number generator
srandom(). Do a "man srandom" for more details.
Seeding it with
time() may be a good idea. Do a "man 2
time" for more details.
You are welcome to code your solution in any language (including scripting languages such as perl) you choose.
Your writeup should provide sufficient visual details for me to understand your results. This may be in tabular form but it may be in graphical form. Your graphs may show data, or xy coordinates.
If you are using Windows, MS Excel has good support for drawing graphs. You might try this tutorial http://www.urban.uiuc.edu/Courses/varkki/msexcel/graphs/Default.html to get started.
If you are using Unix, gnuplot has good support for drawing graphs. You might see http://www.gnuplot.info/ for more information.
You might look at the slides for this project (ppt).
Hand-in a report (your report should be in pdf or postscript or text but not MS Word or any other native document format) containing:
Also, you should include
Tar up (with gzip) your files, for example:
mkdir proj1 cp * proj1 /* copy all your files to submit to proj1 directory */ tar -czf proj1.tgz proj1
then attach proj1.tgz to an email with "cs533_proj1" as the
elm -scs525_proj1 < proj1.tgz to send it,
if that is easier.
Send all questions to (claypool at cs.wpi.edu).