Win a copy of TDD for a Shopping Website LiveProject this week in the Testing forum!

Danielle Honigman

Greenhorn
+ Follow
since Jun 04, 2002
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Danielle Honigman

ah, very stupid mistake...I forgot to declare the static arrays in the beggining of the class and just did the declaration and initiation in the method, which explains why the other methods weren't recognizing the arrays (since they weren't static). Thanks!!! =)
19 years ago
Hi Manfred,
First off, thanks so much for taking all the time and effort to right such a helpful reply! I really like your suggestion of creating a method to get a valid integer from the user, because that makes things a lot easier since everything I'm getting from the user happens to be integers (since that's all I really know the java syntax for as of now). Just a question about that..is there any reason why you create a string buffer object (constructor method?--sorry I am still very new to object-oriented concepts) to display the pattern options on the screen? Oh..good point about the pausing..I didn't even think about the fact that a for loop depends on procesing speed..I was sure there had to be a pause method but I was just using that for the time beign..thanks so much for the info! okay last but def most important: when i modified my code with your corrections i ran into the problem that CurrentGen[][] and NextGen[][] were not being recognized in my NextGeneration() and NumNeighbors() methods...how exactly do I fix that? I tried making C.G[][] and N.G[][] static int arrays rather than just int arrays like you had, but of course that gave me an "invalid start" error because u can only declare static variables at the beginning of the class, so I'm not sure how to resolve that . If you have any ideas I would truly appreciate it. Thanks again!!!
19 years ago
Hi There!
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 ]
19 years ago