String Subscript out of range

Nov 3, 2013 at 4:10pm
I've been debugging this program since yesterday and I continue to run into a string subscript error. I pasted the code in a pastebin (it's only 400 lines), to see if anyone can figure out in their editor why I'm getting this. The problem seems to come up during a debug assertion failure.

http://pastebin.com/b1L8FG4s

Thank you.
Nov 3, 2013 at 5:16pm
My debugger says the problem is on line 224, so it's not an assertion failure.
It's literally what it says. A subscript out-of-range run time error means that you're attempting to access a non-existent array element.
Nov 3, 2013 at 5:39pm
Strange, all I get is an assertion failure on line 429:
fieldToString() returns
+3.X.\nXX.X.\n27.X.\n._.X.\n6..X.\n....+\n

vs
+3.X.\nXX.X.\n.72X.\n._.X*\n6..X.\n....+\n


Edit: added line no.
Last edited on Nov 3, 2013 at 5:40pm
Nov 3, 2013 at 6:39pm
Yeah, but I already put in an error check for assessing any non existent array elements. I've been trying to fix this problem since last night and nothing solved so far.
Nov 3, 2013 at 7:08pm
I dunno man. If you like, I can help you rewrite it. Though I'd need strict guidelines on what exactly it is what you're doing. As far as I can tell, your program is supposed to simulate hive mind behaviour in ants - they collect food and bring it back to the mound.
Last edited on Nov 3, 2013 at 7:08pm
Nov 3, 2013 at 8:19pm
No, it's okay. I can figure it out from here.
Topic archived. No new replies allowed.