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

Questions on HW9-Spring2006

Final homework!
No questions?

Yes, you do?

Well, ask here!


How exactly do the runners move from side to side? Do you have to add to the X values?
They're agents/turtles, right? turn() and forward(). Mark Guzdial

Should our act() in the runner and bull agents be just act() without an input or should it be act(int t).
I don't know if the "int t" part is useful for the headings or not.
I don't think you need the time step.I'd just do act() in both. Mark Guzdial

Headings? You mean directions?
A heading in a turtle (as in a ship), is the direction it's currently facing. Facing due east is heading of 90. Mark Guzdial

"How exactly do the runners move from side to side? Do you have to add to the X values? "
Nope. Think of it as though you were watching the running from the top down. Side to side varies along y.
Set the heading (between 0 and 180), then go forward. You just have to use the turn() method.

"or should it be act(int t)"
Why would act need a timestep? Act does something for just one step.
~Jim
REMOVEDke Jim said. :-) Mark Guzdial

Can you randomize the physical position(left, right, forward) of the runners or do their positions have to match the positions of the bull?
Sort of random – move toward the right, moving a random speed. Mark Guzdial

Some of the picture sprites I'm using look weird in Dr. Java. They all have a line running through them when I try to run the simulation. Is this being caused by the bluescreen?
Don't know. Mark Guzdial

I know the extra credit is for making another runner, but could I make another type of chaser instead? Something like an elephant that chases bulls? Or a crazy bull that chases everything?
Sure – that sounds like fun! Mark Guzdial

I'm having a problem with multiple worlds popping up when I run the simulation. There are only suppose to be 2 things that pop up, right? The simulation and the setUp() frame? I get about 5-6 worlds at a time.
Yes, just two windows should open Mark Guzdial

I'm confused about the correcting mechanism for heading. If the turning each timestep to move from side to side, doesn't that sort of invalidate the rotate by 15 thing to correct their heading?
Right – so do one OR the other. Mark Guzdial

For some reason our runners refuse to be injured. We have code set up in both the bull agent and the runners agent, such that if they are within one pixel of each other, the runner will be injured and we have it setup to drop a different picture of an injured person, and to print out "I got injured!!!" or "I injured a runner!!!". However these never happen. We do not know whyyyy?

Also our runners never make it to the end of the lane. No matter how fast we make them they never go past the mid point.
D&J
One pixel is probably too close. Try 5 or 10. Keep running until they reach the end – you don't have to stop at time 49. Mark Guzdial

Speed isn't the major concern for the runners–remember, if they hit a wall they stop, and the lane is really narrow, so increasing their speed a lot means that they're just more likely to end up running into walls. Try a smaller speed, but have your runners turn intelligently–never allow them to turn more than something like 45 degrees at a time, and also remember the "turn by 10 if they aren't facing 'towards' the right" rule (which I suppose we can interpret many ways, but using 90 as right is probably more likely to get your runners towards the end than using a range). And run your simulation longer if all else fails.

As to the other thing, try increasing the range and see if it works... Maybe the bulls just aren't getting within 1 pixel of the runners...
~Jim

yeah that makes sense... they went a shorter distance when we increased it a WHOLE lot... We were planning to try to find a balance.

However, we tried making the bulls range REALLY big... and just different ones, but it didn't seem to matter.. they also done seem to be running towards a runner if they get close to one either - so we thought maybe our ranges that we set up for that weren't working or something, but we really just don't know...

As for running the simulation longer, didn't it say it was supposed to be 30 timesteps??

D&J

It sounds as though your bulls aren't seeing all the runners... Is your runner list (defined in every runner agent) static?
If you havent't yet, try putting a s.o.p line in bull agent that outputs if closeRunner (or whatever) is null...
Make sure that you have a runner list different than the agents list. You want runners to respond differently to other runners vs. the bulls. Mark Guzdial

We get an nullpointerexception error when the simulation tries to generate the frame with pictures. We used the same code that was used in the BirdSimulation. Does anyone else have this problem or know how to fix it?
Look at the error message. What line is it breaking on? What's going on on that line? (You did this in Python – you have to just look at the backtrace to figure out where the error is.) Mark Guzdial

We had that too at first, and then we realized that we had put our endstep for the frames inside of our setUp... which doesn't work. Or something - I think that was when that happened.. well you can check that at any rate.

How many jpegs do the bulls need? The runners have three: left, right and forward.
Just one is fine. Mark Guzdial

All the runners seem to go off the edges of the world. They all wander on and off the screen. Is this caused by the headings?
Yup. Mark Guzdial

The bulls only NEED one look, but you could give them more I suppose...

Okay... Our dead runners are not showing up in the frames. We have little red dead turtles or injured runner picture in the world, but not in the frame. Is there some way to have that picture dropped in the frame and make it stay ???
D&J
You need to make sure that you do your mapping to the frame when the runner dies, or make sure that the dead/injured runner appears in a list that you make sure that you traverse to write out the bodies to the frame. Mark Guzdial

Did anyone figure out what might cause the nullpointer when the simulation tries to generate the frames.

NullPointer: My Answer: "We had that too at first, and then we realized that we had put our endstep for the frames inside of our setUp... which doesn't work. Or something - I think that was when that happened.. well you can check that at any rate."

Okay.. we got our injured runner pic to show up. Thanks Jim. You rock my face off.

We are getting a null pointer exception at this line of the endStep(int t) method:
drawMe.myPict.bluescreen(frame,drawMe.getXPos(), drawMe.getYPos());

What have you set 'drawMe' to be?
What have you set myPict to be? Mark Guzdial


Our NullPointer was due to failure to assign myPict for Bulls.



Link to this Page