Here are the modifications you must address in a week.
For this part, you MUST trade code with one of your partners. You will
be modifying his/her code.
You can and should still act as a team, and work together to achieve
your goals.
Consider the author of the code you must
modify as a resource. You may find yourself yelling at that resource
or wishing that resource bodily harm by the end of this part of the
assignment. This is normal, but do not act on such impulses. Instead,
inform the resource of his/her transgressions:
- Lack of documentation
- Failure to honor the interface
- Lack of adequate testing
- Failure to provide for exceptional conditions
And now the mods:
- The input format has been changed. In addition to
what you have now, Each line will contain:
- The character U or B to indicate unidirectional or bidirectional.
Please don't send people down a one-way street the wrong way. Your TAs
will not like that.
- A number in the range of 1-4 to indicate the road type.
- Type 1
is a major interstate;
- Type 2 is a US highway;
- Type 3 is a normal city street,
- Type 4 is a dirt road with potholes, sharp/toxic objects from the
town dump, and land mines stratigically
placed to impede your progress.
Why is this useful you ask?
Well, the requests to your program, which used to contain only
a starting and ending intersection, now also contains 4 numbers which
indicate the requestor's average rate of travel (mph) on roads of type
1, 2, 3 and 4.
- You will now receive a file (on cin) of requests for your
program. Your program should behave as if each request were issued
one per run. See the heap mod below for why this is interesting.
- The heap has been identified as a serious bottleneck. It gets
instantiated for each request, but it is always the same size: one heap
slot per possible node.
The heap must now be made a singleton object, appropriately reinitialized
so you can perform multiple path computations more speedily.
- Residents of Manhattan are irate because your path computations
send them zig-zagging through the streets of NYC. You will fix this by
introducing road-name-change-penalties in your
shortest-path computations.
Extra credit:
- Produce output that is more natural, telling people
to turn right, left, etc.
- Introduce turn penalties: right turns are easier than left; going
straight is the easiest thing to do; U-turns are fun but slow.
- Ellide straight segments, telling people what they pass on the way
- Pizza-dude problem (all combinations, travelling salesperson)
- Watch this space for more ideas