I am a newbie to java (and programming in general) and have been working on programming a simple text-based version of Conway's Game of Life. Everything was working perfectly when I had a fixed 10 by 10 array, but then I decided it would be more interesting to have static variables x and y for the length and width of the array so that you could easily change the dimensions of the playing board. So, I did that, and when I initialized them to any value (>= 10 since my start patterns were made with a 10 by 10 in mind) the program worked fine and printed boards of the indicated size. HOWEVER, when I extended that a bit and added some code prompting the user to indicate the desired dimensions, the program compiled correctly but then when it was running I got an ArrayIndexOutOfBoundsException and I can't seem to fix it. I know the error most
likely lies somewhere in the user-prompting code, but everything seems fine to me. I think for some reason the JVM is reading whatever number
I type in first (which is when you're prompted to choose a start pattern between 1 and 7) as the dimensions, but I'm not sure why. I have been tearing my hair out trying to debug this program, so I would GREATLY appreciate any help anyone could provide!
My code would probably be helpful =-P so here it is...I hope it's readable after all this cutting and pasting into this forum:
Thanks in advance for your help!
[ June 04, 2002: Message edited by: Dirk Schreckmann ]