Darwinbots Forum
Code center => Bugs and fixes => Solved Bugs => Topic started by: PurpleYouko on October 31, 2005, 08:58:51 AM
-
Here is another one.
Over the weekend, I got a crash in "Nextelement" subroutine in the "mutations" module
Public Function NextElement(ByRef DNA() As block, beginning As Integer, tipo As Integer, value As Integer) As Integer
'takes the input for the first value in a gene and returns the position of the next statement
'as defined by tipo and value
Dim k As Integer
Dim uboundarray As Long
uboundarray = UBound(DNA())
If DNA(uboundarray).tipo <> 4 And DNA(uboundarray).value <> 4 Then
ReDim Preserve DNA(uboundarray + 1)
DNA(uboundarray + 1).tipo = 4
DNA(uboundarray + 1).value = 4
End If
k = beginning
If beginning > 0 And beginning < uboundarray Then
While Not (DNA(k).tipo = 4 And DNA(k).value = 4) And Not (DNA(k).tipo = tipo And DNA(k).value = value)
k = k + 1
Wend
If Not (DNA(k).tipo = tipo And DNA(k).value = value) Then k = -1
Else 'beginning wasn't valid
k = -1
End If
NextElement = k
End Function
for some reason 'k' was getting bigger than the maximum array size (defined in 'uboundarray')
Below is the fix for it.
By adding a conditional to exit the while loop if 'k' exceeds the allowed value, we can prevent the crash. Not sure if this will cause other problems further down the line by the function returning the wrong value. Shouldn't though because the conditional outside the while loop should set 'nextelement' to -1 anyway.
on jumping out of the while loop, 'k' has to first be set to a usable value so I set it to the maximum possible value of 'uboundarray'.
Public Function NextElement(ByRef DNA() As block, beginning As Integer, tipo As Integer, value As Integer) As Integer
'takes the input for the first value in a gene and returns the position of the next statement
'as defined by tipo and value
Dim k As Integer
Dim uboundarray As Long
uboundarray = UBound(DNA())
If DNA(uboundarray).tipo <> 4 And DNA(uboundarray).value <> 4 Then
ReDim Preserve DNA(uboundarray + 1)
DNA(uboundarray + 1).tipo = 4
DNA(uboundarray + 1).value = 4
End If
k = beginning
If beginning > 0 And beginning < uboundarray Then
While Not (DNA(k).tipo = 4 And DNA(k).value = 4) And Not (DNA(k).tipo = tipo And DNA(k).value = value)
k = k + 1
If k > uboundarray Then k=uboundarray GoTo jumpout
Wend
jumpout:
If Not (DNA(k).tipo = tipo And DNA(k).value = value) Then k = -1
Else 'beginning wasn't valid
k = -1
End If
NextElement = k
End Function
-
I think I got this crash; run-time error 9: out of bonds something, I don't remember.
This line of code was marked with yellow in debug mode:
While Not (DNA(k).tipo = 4 And DNA(k).value = 4) And Not (DNA(k).tipo = tipo And DNA(k).value = value)
I added your fix but there seem to be something wrong with it. This line of code is displayed in red text:
If k > uboundarray Then k=uboundarray GoTo jumpout
I also get a 'Compile error: Expected: End of statement'
The word 'Goto' gets marked.
-
See for yourself then:
-
for some reason when I put that code up in a "code" window, it didn't show the colon in the middle of the line.
This is what it should be.
If k > uboundarray Then k=uboundarray: GoTo jumpout
The colon indicates the end of one action and the start of the next.
-
That didn't fix it either, PY! Did you even try to run it yourself?? :pokey:
-
HELLO???
Could someone please give me the RIGHT CODE to put in! The above fix doesn't work!
-
That didn't fix it either, PY! Did you even try to run it yourself?? :pokey:
Yes I did. It has been running faultlessly for days now.
-
That's my problem. I can run sims for months if I wanted, and as soon as I release it people find ways to crash the program in a matter of hours...
-
Tell me about it.
the modded 2.37.4 code has been running non-stop on my computer at work for about a week now. It hasn't crashed since last Tuesday. <_<
-
Yeah, something got broken. I have not run DB for a long time, but now I re-downloaded everything and fresh-installed and now I can't run 2.37.4. Weird. It crashes in like 5 minutes.
How come? I used to run sims for weeks. I think I had 2.37.4, but I am not sure.
-
There's nothing in the sysvars files that's not backwards compatible. There's nothign in them that even can be non-backwards compatible.
I've also had no problems-- ever-- running older versions with newer sysvars.
This sounds suspiciously like the same sorts of superstitions that pro athletes have. If it makes you happy to use older sysvars files, go ahead. It doesn't hurt anything...
-
DB works for me on my computer. Versions you've had problems with shvarz has managed to run simulations in that accumulated millions of cycles.
so perhaps you should modify it to:
"bottom line: I can't figure out how to get DB to run for me." --or --
"bottom line: DB doesn't work for me on my settings."
You seem to have a knack for running settings that break the sim. Congratulations, you are truly a magnificent bug tester. I know that's not what you wanted to hear, but it seems to be fact.
2.4.9 has had it's hard drive routines totally revamped, so you should be able to set up autosaves. (older versions were saving and loading the bots, but screwing up the settings) If it crashes, you can just load the last autosave.
-
I have just spent the last week and a half fixing V2.37.4.
I have thrown everything at it and managed to reproduce and fix every bug that has been reported to me and a few that weren't.
The bottom line is that the 2.37.5 source code ran for over a week without a crash and the executable has now clocked up over 5 million cycles without a hitch.
I have tested it on my 1.8 gig, win 2000 system at work, my 700meg win ME system at home and my daughter's 3 gig Win XP version.
I can't break it!!!! As far as I can tell we have a version that now works. If you know otherwise then please tell me how I am supposed to fix it.
-
Griz, you are the one being immature here.
1. The version that you say is broken works for me. Period. No tweaking done, just d/l, install, click start. It runs. It runs for a very long time and does not crash. If you found something that reproducibly breaks the program - please test and report. It will get fixed.
2. Your constant whining "this is going in the wrong direction" is really annoying. The reason for it being REALLY annoying is that you don't actually say what part is going in the wrong direction. And you don't propose any modifications that would help it move in the right direction. You don't. There is no substance in your posts. Just complains and accusations.
Really. If you don't change your attitude, then please do leave and please don't come back. It's just not constructive to have people like this on the project. :angry:
-
well, that just means that you have a bad install.
it certainly does not mean that we don't have a stable version
solution: do a fresh install. Easy.
-
as I said, try a new install. and pls mention what version you are talking about?
2.37.5 certainly works well for me.
-
Hmm, I think you have a problem of expecation.
Simulations that run at 2 cycles a second I would consider somewhat annoying but workable. Yes, it takes a long time to accumulate more clock cycles, but you probably have a large population, and so a more stable predator/prey interaction, and so perhaps you can increase mutation rates a bit (muller's ratchet is dependant on sample size).
If most of the bots are veggies, you can tweak the veggy controls so there'll be less veggies on the screen at once.
If your veggies are turning cancerous, try feeding them based on "kilobody" points. This does not reward veggies that reproduce unchecked. Feeding them nrg per veggy does reward these sorts of veggies. Hence why you're seeing them.
If robots aren't losing nrg, you probably haven't set up the costs page. It may not load older settings for nrg consumption. It's sort of a pain, but to make it do otherwise is sort of a pain as well.
Robots existing outside the borders in 2.4 is totally permissible. They just get forces applied to them to push them back in bounds. The simulation 'strongly encourages' that they remain inbounds. Simply aproach the simulation with the mentality that out of bounds is merely an area that the bots are encouraged not to go to instead of some mystical 'do not enter' area.
About the only thing happening to you that isn't supposed to happen is crashes and freezes, which seems to be just about missing from everyone else's computers. Uninstall and reinstall, and see what you get. If that doesn't work, congratulations! you are a truly excellent bug tester. We should get you a plaque (or is that the stuff on teeth?)
Anyway, running evo sims in DB is an art. It takes alot of experimenting and a sort of 6th sense that comes with practice. Ask yourself: "if something interesting did develop, would I be able to tell?"
-
That didn't fix it either, PY! Did you even try to run it yourself?? :pokey:
This problem I reported, you don't get the same error? You have the same fix in this version and you DON'T get this compile error???
-
Have you downloaded the source code PY's posted, to be sure your sources are in sync? It was a minor problem, I think he fixed it.
-
Hmm... Has he uploaded that recently? I checked the ftp on the wiki. Couldn't see any source code for this version; 2.37.4 right? I'm starteing to forget what version this topic was about. What should I download exactly and where is it?
-
There was a post about it in the announcements forum. 2 actually. Are you not looking at announcements?
-
It is on the FTP, but you may need to clear your temporary internet files to see that it is (The wiki is funny that way).
-
I think I found it. it's 2.37.5, right? I guess I got dizzy with all the versions.
-
Hmm, I think you have a problem of expecation.
you are correct. as always. ;)
yes ...
I expected DB to actually work.
sorry ...
my bad.
good luck guyz.
Hmm, yeah, that's a real useful post <_<
-
How about some posts that actually tell us what is wrong.
Griz: You say that 2.37.5 hangs on the loading screen? Run it from the source code and tell me exactly which line of code hangs so that I can fix it.
Both the source and the executable are on the FTP so it should be easy enough to do that. Frankly, I don't see what could be wrong other than a dodgy file download. I didn't change anything in that area of the program.
Let's try to keep things civil eh? I want this program to work too but I just don't understand a lot of your comments. You see things going in the exact opposite direction that Num and I have been heading. I just don't know whay that is.
-
I think I found it. it's 2.37.5, right? I guess I got dizzy with all the versions.
Right. That would be the one.
You don't even need to go to the FTP to get them. I included download links directly into my posts in announcements.
-
you really can be quite an arrogant, condesending ass, Nums ...
Haha, you are like the 5th person this week to call me either evil or an ass.
Might have to start believing that if this keeps up. But my D&D games say I'm neutral good XD
-
But my D&D games say I'm neutral good XD
I usually play Chaotic Neutral although a nice Lawful Evil character can be fun too :evil:
-
Nextelement has been put to bed.
Moved to fixed forum