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

Questions on HW8-Spring2006

Got questions about corn and deer and wolves and birds and bees?

We can answer questions on the first three here.

Ask away!


question time–you said we should turn in one "set" of files. so are we going to end up turning in a cornAgent.java, deerAgent.java, wolfAgent.java...and one cornWolfDeerSimulation.java? or should the agent documents be combined to one?
Turns out that the Homework description was correct already – it says turn in "Agent and Simulation SUBCLASSES". Turn in Agent and Simulation, too, if you change them, but you shouldn't need to. Mark Guzdial

do we also need to include the deer.java, wolf.java, and corn.java as well? or will the Agent.java files be sufficient?

If you have deer.java, wolf.java, and corn.java, you're doing something wrong. Mark Guzdial

Questions:

1. Will corn look like a turtle?
It's up to you. It can look like Ken or a Bratz doll, if you want. Mark Guzdial

2. By changing the rules, you mean changing stuff like how many weeks deer live without corn, how fats wolves run, etc....
Yep! Mark Guzdial

3.Do we have to make the JPEGs, or is that optional?
Make the JPEGs? You mean the frames of the animation? Totally optional, but if you do an interesting run, feel free to send them to me and I'll make a movie of them for you. Mark Guzdial


Would making a male/female deer mean making subclasses for deerAgent or just modifying it a little more. The gender thing confuses me...

Your call! Either add an instance variable for gender, or subclass. (That's why it's extra credit.) Mark Guzdial


Do we use deer.java and wolf.java at all? I'm just making sure.
No, use DeerAgent and WolfAgent and WDSimulation Mark Guzdial

For cornAgent.java, all the corn does is grow, correct? So the subclass won't have much in it, outside of a loop or something to get the corn to generate more corn every 12 weeks, right?
Corn grows, dies, and has baby corn every 12 weeks. Mark Guzdial

Anyone interested in seeing something really funky with the following symptoms... Let us know!
We are having unique problems right now...

1)Agents aren't getting removed from the list i.e. Red dead bodies running around
2)Corn isn't being added or removed, it's just there
3)Our Agents are drawing lines
4)They are all moving to the top left corner of the world
5)Speed isn't changing
6)Sometimes they stop moving and are red (ie dead), but the count is always the
same at the end (does that count as success since no matter what, there's still the
same number at the end as at the beginning??... No?? yeah didn't think so.. ;))

~Doroteya & Jennifer

1) Hmmm... That's odd–Agents already know how to die, so that shouldn't be happening. Are the lists of agents that you're making static?
2) Not added or removed to which? It must be added to something if it's there...
3) Aren't they supposed to? You mean there's no turtles? (Make sure the turtles aren't being set to hide)
4) Hmmm. Must be something in your act telling them to do that... I have no idea.
5) Can't help you there w/out seeing code on that one. :(
6) Maybe similar issue to #1? If your agent arrays aren't static, they might not be removed from the right list... Though implementing a 'zombie deer' rule would certainly be a unique way to get your simulation balanced...

~Jim

I just went through Doroteya's and Jennifer's code, and it suggests somethings for everyone to watch for:
I will be at Office Hours on Friday from 1-2, then I have to leave to pick up kids from school. I'll be available electronically up until the turnin. Mark Guzdial

Interesting problems? Care to hear some more?

1.Corn is being added, but doesn't appear on screen. Its only added to the list.
2.Corn gets eaten, deer move away, corn comes back to life.
3. The world seems to shift to the left a little every few steps


Also, has anyone had a wolf die yet? I'm starting to think they may be immortal...or too well fed.
Most of these problems are because of the creating-from-one-list, running-from-another problem, I think. Mark Guzdial


Exactly how do you fix this create one list, run another problem? Which list do I get rid of, the one Agent makes or the one I made within DeerAgent, CornAgent, etc.



Follow the original WDSimulation and only create agents in setUp(). Mark Guzdial

Am I the only one having some serious corn problems? There appear to be way too many to run the simulation with the original conditions... It froze Java after about 900 were created (85ish steps). I think that the problem is just that the # of corn triples every 12 steps, and the deer start dwindling, and it's all over. Is it ok if we run 3 sets of rules, but don't use the initial numbers from the homework?
~Jim

Correction:
The deer have a very very small smell range (5) for corn. I've discovered that in most cases Zero deer find corn within 4 steps. By timestep 5, all deer have starved (and the wolves soon follow). It's very sad. But, yeah, same problem: the corn runs so rampant, my computer seems to be having serious issues. So, Same question: can we submit 3 of our own rule sets, or must we use the initial rules (if so, can they be tweaked a bit?)
~Jim
Yes – perfectly reasonable thing to do. I didn't check the numbers first, so it's not too surprising that I gave you an out of balance ecology to begin with. DON'T run my numbers – start out with more deer, or with a larger smell range for corn. But do run three sets of rules/numbers. Mark Guzdial
Phew! Thanks! This is what mine was looking like @ timestep 75:
Uploaded Image: timestep75.JPG|
I think now I'll change some numbers :) ~Jim

So...its okay then that all the deer seem to die in the simulation....I thought I was doing something wrong.

But I'm still having another problem. All the deer start dying at timestep 3, and not 4. The same issue with the wolves.
They all seem to die one timestep too early.

Do your timesteps start at 0?
Oh, btw folks, when outputting your data, you may want to take a look at lineForFile(), if you're using WDSimulation as a reference..
Mine had a small typo, it was adding /t after each entry. The result was that I was not getting a tab delimited output! Use \t instead, if y'all's is like that...
~Jim

You're right with the fix, Jim, but I'm sorry (and somewhat surprised!) that that bug is still there. I thought I'd tested that–but obviously, I didn't!
I think it's a pretty interesting result that if the Deer can't find the corn, they all die off then the corn just goes bonkers growing everywhere (nothing to stem the tide).
I agree with Jim – it's probably a timestep==0 issue. I'm not too worried about an off-by-one error like that. Keep plugging away! Mark Guzdial

To get the world from the Agent, use this.getModelDisplay(). To get the simulation from the agent, use this.getSimulation(). Mark Guzdial

To create your text file, you need to start out saying simulationInstance.openFile("C:/mytextfile.txt"); after you create your simulation instance. AFTER running, you need to say simulationInstance.closeFile(). And notice Jim's comment above – WDSimulation.java has "/t" where it should have "\t" in lineForFile(), and you'll need to fix that. Mark Guzdial

So which numbers can we change now?? Can we change how often corn reproduce?? I'm unclear as to what numbers/rules are "set in stone" as it were, and which ones are variable...

~D&J

All numbers = variables. REMOVEDge whatever you want. That's what we did.

Agreed – nothing is set in stone. REMOVEDge whatever you want. Your goal is a balanced ecology. Mark Guzdial

I am glad we got this response before we had to turn it in :\

If you want a question answered early enough to be useful, ask it early enough to be useful. I make a serious effort to respond here, but it's not my job to answer questions in the last hour or two that should have been asked much earlier. Mark Guzdial


i keep gettin errors like this
Exception in thread "AWT-EventQueue-0" >>> Timestep: 6
java.util.ConcurrentModificationException>>> Timestep: 7

>>> Timestep: 8 at java.util.AbstractList$Itr.checkForComodification(Unknown Source)
at java.util.AbstractList$Itr.next(Unknown Source)

>>> Timestep: 9 at Pen.paintComponent(Pen.java:138)

>>> Timestep: 10 at SimpleTurtle.paintComponent(SimpleTurtle.java:629)

>>> Timestep: 11
at World.paintComponent(World.java:142)>>> Timestep: 12

>>> Timestep: 13
at javax.swing.JComponent.paint(Unknown Source)>>> Timestep: 14
at javax.swing.JComponent.paintChildren(Unknown Source)

at javax.swing.JComponent.paint(Unknown Source)>>> Timestep: 15

at javax.swing.JComponent.paintWithOffscreenBuffer(Unknown Source)
>>> Timestep: 16
at javax.swing.JComponent.paintDoubleBuffered(Unknown Source)
at javax.swing.JComponent._paintImmediately(Unknown Source)Deer left: 15

at javax.swing.JComponent.paintImmediately(Unknown Source)
at javax.swing.RepaintManager.paintDirtyRegions(Unknown Source

and i'm just running the original program, is there something wrong with my other java files?



Link to this Page