Hi, I am working on developing the Game-Of-Life in java. Just atthe beginning. I
ID: 3608075 • Letter: H
Question
Hi, I am working on developing the Game-Of-Life in java. Just atthe beginning. I created a 2 dimensional array of 19x19 that holdsintegers "1" for alive cells and "0" for dead cells. When it cameto calculating the next generation: I have to check each cell bychecking the status of every cell around it. I have tried checkingcells that have 6cells around them, cells at the 4 cornersand cells at the 4 edges but it is a lot of code and it's not evenworking because I get index OutOf bounds exceptions. I waswondering if there is a way of using an array of maybe 20x20 orbigger but just use the 19x19 i need for the game. I have tried butnot able to deal with the corners and edges.Explanation / Answer
public class GameOfLife {public GameOfLife() {}public static boolean is_valid(int [][]data,int i,int j){if(i>=0 && i=0 && jRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.