Change Contents of the Bubble
View this PageEdit this PageUploads to this PageHistory of this PageHomeRecent ChangesSearchHelp Guide

Questions on HW7-Spring08

I just unzipped the folders for HW7 and I can't run traffic.java, it gives me an error that says:
NoSuchFieldError: screenSize
at Map.(Map.java:31)
at Traffic.(Traffic.java:66)
at Traffic.main(Traffic.java:111)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
>

I also can't run the vehicle class, it says that it is something wrong with the Global class
My corn is moving all around like a deer in panic!
I'm using a random generator of posX and pos Y of the corn, but in somewhere this random position is being actualized...
How can I stop this crazy corn?? I have been trying in Model.java... but I couldn't.

public void draw(Graphics g) {
g.setColor(color);
Random x = new Random();
Random y = new Random();
int posX = x.nextInt(100); // to concentrate them in the left upper corner
int posY = y.nextInt(100);
g.fillOval(posX,posY, radius, radius);
}

Is it okay to create a vehicle that extends the Car class (which in turn extends Vehicle)? Or does it have to extend the Vehicle class directly?
when you say "Just don't update the position of the corn" where it happen?
because now I have all my corns in the same fixed position. Like 20 of them in the same x,y...
Where can I stop the actualization?
Is there any examples of how to modify the motion of a created veheicle to make it do something different from other veheicles? Thanks.
I defined the deer states, I think they are working, but I can't choose the state AFRAID because the wolf....
How can I compare the state and choose one?

the samples codes have living state defined in Agent, the parent class. But in in the hw7 downloaded files Agent hasn't such boolean thing....And additionally we will not submit our own version of Agente.. So, based on what we could make disappear the eaten corn?
Are we allowed to copy and paste code from the Traffic thing to make a new vehicle?
The homework directions say "Any time a hungry wolf appears, the deer needs to switch to fleeing state." But in the code you gave us, the wolves never become hungry so should we just ignore this? Or should they flee if any wolf is nearby?

I meant can we copy and paste code from other Vehicles?

Are we supposed to be doing HW7 in our pairs?

Do we have to periodically add more corn using an update method, or can we do it another way - because I did it without calling an update method.

how do i delete one piece of corn in the list? I keep deleting the whole list of corn...

If our vehicle is a plane is it necessary to make it have random flight paths or is it enough if they all go in the same general direction (as if to a landing strip)?

My program only wants to make newscopters, blimps, police cars, and tanks. How can I make the cycles and semis show up? I don't think I changed any of
the original code yet.

Do we have to create our new corns near existing ones? How do I do that?
I'm writing the update() method for Corn, and it'd be handy to have access to dp in Agent. Is it OK to change dp to public, as long as we submit Agent with our homework?
I'm trying to get the coordinates of one vehicle and use those in the update method of another, essentially moving vehicle B to vehicle A. How do I go about doing so? I tried writing getters in Coord to get the X and Y value of the coords stored by vehicle A, and then setting those to the X and Y positions of vehicle B, but that doesn't seem to be working. Ideas?
There is nothing in the police car class about moving to another target's coords.
the target vehicle is always moving.



Link to this Page