 |
|
|
"On close, it is not clearing instance of application, so clean it using task manager."
Try this:
insectcontrol.dispose OR insectcontrol = nothing
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
Hi,
Granted the article may need a little extra work, and although I haven't looked at the code, you can't say that the person who wrote the article can't program. The reason why I state this is because it seems that this aritcle could be the grounding for a agent based simulation (www.agentsheets.com is one I used in university), take the following point, how could a bit array hold state information about every agent in the program? And you "critics" call yourself programmers . Basing each ant/wasp whatever you want to test hypothosis for swarm based systems/agent based systems around an "object" which can hold state information is the correct method, I think.
I can't say I have seen the code or if the implemention is "efficient" but could you keep your comments constructive, especially since I can see great promise from this article if given time to let the project take it's course.
Paul Kinlan.
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
Kinlan wrote: I haven't looked at the code
You really should...
Kinlan wrote: how could a bit array hold state information about every agent in the program?
Sigh... that is just an example of the minimum possible footprint. Please look at the code in more detail. I predict you will retract your comment...
Kinlan wrote: And you "critics" call yourself programmers
How dare you call me a critic
I always thought you could do a "game of life" algo with only a tiny amount of data for each square. Correct me if I'm wrong... but every site I've been to or book I've read says the same thing. I kind of thought that was the whole point.
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
dog_spawn wrote: Sigh... that is just an example of the minimum possible footprint. Please look at the code in more detail. I predict you will retract your comment...
I probably am not going to look at the code, because I think the article needs more work, i.e motivations, conclusions. Agentsheets uses a class per agent (ant for instance) and can have several agents on top of each other. I think that this "idea" would be a good starting ground for a great article.
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
I actually missed out what I was going to say.
Really the minimum footprint requires more definate requirements. If it was a simple game of life then yes your assumption is correct. Anything more complex may require a none bit array (integer array). Any intelligence will require an object array at the bare minimum.
regards Paul
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
Kinlan wrote: Any intelligence will require an object array
Of course The thing here is how and what type of objects are used. Believe me, the devil is in the detail with this article.
You agree with the original comment that it is silly to have a control/object per drawn square? Clearly the author should have coded a custom control to draw the model.
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
Well..... I would have created a container control, that each "Ant/Virus" would know that it has to draw into, but I can see why you would use a UserControl for each square (errrr... If you wanted a smooth refresh of the controls, then only the control that is redrawn has to handle the OnPaint event). It is a trade off for ease of use I think, each "Ant/Virus" can handle it's own destiny so to speak directly on the form. But then again I have not seen the code.
|
| Sign In·View Thread·PermaLink | 1.00/5 (1 vote) |
|
|
|
 |
|
|
Ehh...
No more 'ease of use' is involved with implementing UserControls than it would be implementing a container control...
As for your argument about the insects having intelligence -- there are only three "Life cycle rule" that the simulation must follow... No intelligence is assumed.
Thank you, dog_spawn -- minimum memory footprint was exactly what I was trying to explain.
Also, I'm not trying to discredit the guy, really -- I mean, he did have the guts to post this to CodeProject -- I have yet to do that myself.
Skydive -- Testing gravity, one jump at a time.
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
dzCepheus wrote: As for your argument about the insects having intelligence -- there are only three "Life cycle rule" that the simulation must follow... No intelligence is assumed.
Hmm, I think I might have come across wrong, I was trying to imply extenisibility futher than what the three rule suggest, be they emergent properties or not.
Ahh well.
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
A UserControl for each insect?
Wouldn't it be easier and more efficient just to store an two dimensional array of booleans, have the simulation act on that data, then create an in-memory bitmap every pass to render the display to, then copy that in-memory bitmap to the form when the paint event is received?
This way, you'd be dealing with far fewer objects for the garbage collector to clean up, plus a lot less memory overhead from all those objects, not to mention the GDI resources they use... Please correct me if I'm wrong, but aren't UserControls considered windows by the operating system?
Skydive -- Testing gravity, one jump at a time.
|
| Sign In·View Thread·PermaLink | 4.64/5 (4 votes) |
|
|
|
 |
|
|
 |
|
|
4000 insects should only require 500 bytes, if you use an array of bitarray objects, plus any overhead from bitarrays. *sigh*
Oh well.
Skydive -- Testing gravity, one jump at a time.
|
| Sign In·View Thread·PermaLink | 5.00/5 (1 vote) |
|
|
|
 |
|
|
I wrote same program with so many diff combination. One of them is what ever you suggested. But I want to write true object oriented. In this example each object is seperate and holds it own state. each object has timer which check induvidual next status. I know it is wrong idea to create 4000 timer. it is just overhead on system to run 4000 message loops as well. But I just created for Fun. I belive there will be so many good idea to solve same problem.
Ashvin Patel
|
| Sign In·View Thread·PermaLink | 1.00/5 (1 vote) |
|
|
|
 |
|
|
 |
|
|
"Senior Software Er. Aspect Communication San Jose USA CA"
No offense, Ashvin, but if I were a Senior Software Engineer(?), I would have spent a little more time working up a proper Code Project article. Perhaps something my boss would be proud of...
Wish I had your job...
Skydive -- Testing gravity, one jump at a time.
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
Of course. The author has completely missed the point and is clearly of sub-normal intelligence.
His profile says he is a "Senior Software Er.". OMG talk about promoted to your level of incompetence.
It is a good example of the lengths idiots will go to write massively stupid code.
This article should be deleted ASAP.
|
| Sign In·View Thread·PermaLink | 1.00/5 (2 votes) |
|
|
|
 |
|
|
Now that is not an acceptable comment. As the author said, this WAS an exercise in objects that know their own state. WHY the hell does everyone bitch about the design, when anyone can see that this example is illustrative and descriptive of a real solution. Everyone of you so-called experts is griping about the solution but NO one offers concrere illustrative improvement? Go to jump of a cliff. We NEED more concept models, not less. OF COURSE for real world application you would choose different options and implementations methods, BUT that is NOT the point of this example.
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
What you say is fine, but when you look at the actual implementation you will change your mind. You have to always bear in mind people use this site when learning a programming language. That is why it is so important to make sure the implementation is practical. I totally agree with the spirit of what you are saying, I just don't think it applies to this case. Does that make sense?
|
| Sign In·View Thread·PermaLink | 5.00/5 (1 vote) |
|
|
|
 |