I'm trying to make 'The Game of Life' in Java. I made a 2d matrix and filled it with boolean values.
Now I'm trying to count the boolean values of adjacent cells that are true, but when I use =, I get all of the cells surrounding it (eg: a cell in the middle gives 8, a cell on a corner gives 3) and when I use ==, I just get all 0's.
Example if statement (first one works, second doesn't work):
if(!celloc.equals("URC") && !celloc.equals("RightB") && !celloc.equals("LRC")) {
if(current[i][j+1] = true) {
life++; // right
}}
currentis the array that contains the boolean values thenif(current[i][j+1])is enough