3 hours later...
public void verifica_inicio(int[][] matriz, int n){
int i;
int j;
int temp;
int temp_2;
int temp_3 = n;
Random rand = new Random();
Type: Posts; User: jtmnf
3 hours later...
public void verifica_inicio(int[][] matriz, int n){
int i;
int j;
int temp;
int temp_2;
int temp_3 = n;
Random rand = new Random();
I can answer with this:
matriz[pos_x][pos_y] == matriz[pos_x][pos_y-1] && matriz[pos_x][pos_y] == matriz[pos_x][pos_y-2]
matriz[pos_x][pos_y] == matriz[pos_x][pos_y+1] && matriz[pos_x][pos_y] ==...
There aren't counters...
My thought: search in the rows... Search for a sequence of 3 or more numbers... If it find it, change the first number to another... Now, it returns to search in the rows...
matriz[pos_x][pos_y] == matriz[pos_x][pos_y-1] && matriz[pos_x][pos_y] == matriz[pos_x][pos_y-2]
matriz[pos_x][pos_y] == matriz[pos_x][pos_y+1] && matriz[pos_x][pos_y] == matriz[pos_x][pos_y+2]...
I already do that, I swear... I don't understand what's missing :S I already have Array out of bounds a bunch of times...
I already do that, but I appears that at the end, there is, once more, a sequence of 3 or more pieces of the same color... :S I cannot do anything more, I exhausted...
pos_x/pos_y is the position in the matrix
fig_aleat is the random piece that is randomized at the moment
When returns 1, it indicates that there's no 3 or more pieces (numbers) in sequence!
I messed up... It's a nxn grid, not nxm, sorry... But yes! If 3 or more numbers are the same, I have to change the 1st appearence of that number to other!
This situation:
1652
The green rectangles...
The code should see if there are 3 or more pieces in consecutive positions...
The "aleat_fig" as the values 0 to 5 (6 pieces)!
For example, I cannot have this combination:
# EDIT -> it's nxn,...
I need help... I'm doing Bejeweled in JAVA, but I need help to overpass a problem...
When I start the board for the first time, I cannot have 3 or more pieces of the same color, but my function...