|
C M S C 2 1 4 C o m p u t e r S c i e n c e I I F a l l 2 0 0 2 |
On a daily basis.
If true, the plan involves donating gifts (thus, it applies
to PeaceShips). If false, the plan collects gifts
(thus, it applies to WarShips)
It refers to the distance of individual hops. It may
take more than one hop to reach the destination planet.
A hop is defined as a single move made by a ship, which
is based on the range of the ship. Thus, if a ship has
a range of 3, it can move to a coordinate with a Manhattan
distance of 3 away (i.e., the difference in the x and y coordinates
summed up is 3).
Several things. You can come up with a plan that costs less
overall then a very bad plan. You can implement Dijkstra's algorithm.
You can implement a brute force shortest path. You can do recursive
calls that can "backtrack" when a path fails. Make sure you mention
this in your README when you submit it. The total extra credit
is up to 10 points.
No. Right now, it's only set up for verifying PeaceShips.
When we grade your projects, we will have a version that works
with WarShips.
However, if you're adventurous, you can attempt to write
the verification for WarShips to do the checking (or
check it by manually inspecting it yourself).
It seems many students wish to change methods because it
is "convenient" to do so. As long as your code works with the
verifier and the main provided and does not require you to change
your the verifier code, then you can make those changes.
Realize that in more realistic settings you may often be
constrained to use the methods as provided, and making changes just
because you don't have convenient methods may not always be
an option.
You should NOT modify the behavior of existing methods (unless
they were "buggy").
No. You just have to find a path from the source planet to the
destination planet. It can be ANY path, provided the ship can
land on the planets, and fly within their range.
Furthermore, should you decide to do a shortest path algorithm,
it does not have to be Dijkstra's algorithm. You are allowed
to find code on the "web" (but not solicit other people to write
your code for you, nor borrow code from other students) for
Graphs and Dijkstra's algorithm and Heaps.
However, you must cite, in a README, where you found the
code.
The shortest path is not based on distance but on TOTAL FEES.
You want to find the cheapest way to fly the passengers.
In project 3, it was convenient for some students
to make toString() behave differently from printing the
"tree". So, to make that possible, yet allow testing to
print the "tree string" by using getTreeString().
So, just in case you need the same flexibility for P4
(you shouldn't, but just in case), there are two functions:
getShipString() which is used to print the contents
of a ship and toString(), which you can use for
overloading the output operator.
If you still have no real purpose for it, simply do:
It's meant to return true when the passenger being seated
in a seat whose index lies within the valid bounds (thus, if
there were 6 seats, the passenger is seated between 0 and 5),
and false if it's out-of-bounds.
Using this definition, a passenger would "kick out" the
previous passenger, were there someone seated there.
However, you can assume that when the function is being
called, there will be no passengers seated.
Downcast, using dynamic casting. You should check your
class notes on how to do dynamic casting.
Basically, you should create a pointer of type const Passenger *
and the dynamic cast to, say, const Human *. If it's not
NULL, then it's a pointer to a Human. You can use
similar tests to determine if it's a Droid or Cargo.
Instead of casting to, say, Human *, cast to
const Human *. And when you save a pointer, save
it as a const Passenger *.
return getShipString() ;
and proceed onward.
|
See the class syllabus for policies concerning email Last Modified: Tuesday September 3, 2002 |
|
|
|
|
|