|
Im having a problem with 2d arrays. How can I assign a value to each spot in the array? I dont know if this would further complicate the issue, but the size of the array is based on user input. this is what i have right now. My hope is that this will assign a random boolean to each location within the array. Will this function how I would like it to? quote:boolean[][] lifegame = new boolean[i][h];
|
# ¿ Apr 10, 2008 22:55 |
|
|
# ¿ May 6, 2024 05:21 |
|
yay, thanks for that catch. I have one more problem im running into. How can i check the values next to each in an array? say, if this would be how it is saved in the array quote:
I need to be able to check the value for each adjacent item in the array. Is this possible, and any hint on how to do it?
|
# ¿ Apr 10, 2008 23:59 |
|
Incoherence posted:Suppose the point in question is lifegame[x][y]. What are the indices of the four adjacent points (or eight, if you want to go that way)? if i understand what your asking, you want the positions of the 8 adjacent 'boxes' quote:
Im assuming this is what you meant by that. As for checking, they will need to drop off and not wrap around. Let me know if i understood what you were asking.
|
# ¿ Apr 11, 2008 03:28 |
|
haha, yeah thanks for helping point my mind in the right direction. as soon as i drew it out and worked it out I saw a possible way to do it. Thank you so much.
|
# ¿ Apr 11, 2008 04:22 |
|
ahhhh! quick question How can I add 2 things into the same JFrame! Both will work seperately, but when I try and add both in at the same time one will overwrite the other. im hoping this will be something somewhat simple. quote:
Component2 will show, but component wont show up at all. By themeselves, they will be up and working just fine, just not together... Drumstick fucked around with this message at 06:59 on Apr 25, 2008 |
# ¿ Apr 25, 2008 06:55 |
|
|
# ¿ May 6, 2024 05:21 |
|
okay thanks! i will look into that right away. I havent had to add two components into a frame before, thanks again
|
# ¿ Apr 25, 2008 07:45 |