float [][] plants = new float[cell_all_x][cell_all_y];
int interface_width = 300;
int interface_colors[] = {0, 0, 0};
myFont = createFont("TimesNewRoman", 14);
for (int i = 0; i < cell_all_x; i++) {
for (int j = 0; j < cell_all_y; j++) {
plants[i][j] = int(random(255));
gameboard_width = width - interface_width;
interface_x0 = gameboard_width + 20;
x_step = int ( gameboard_width / cell_all_x);
y_step = int (height / cell_all_y);
for (int j = 0; j < cell_all_y; j = j + 1){
for (int i = 0; i < cell_all_x; i = i + 1){
fill (0, int(plants[i][j]), 0);
rect (i*x_step, j * y_step, x_step, y_step);
for (int j = 0; j < cell_all_y; j = j + 1){
for (int i = 0; i < cell_all_x; i = i + 1){
text (n, x_step/3 + i * x_step, y_step/2 + j * y_step);
x = constrain(x, 0, gameboard_width - 10);
if (x < gameboard_width){
cell_x = int (x / x_step) + 1 ;
cell_y = int (y / y_step) + 1 ;
cell_number = cell_all_x * (cell_y - 1) + cell_x;
plant_number = plants [cell_x - 1] [cell_y - 1];
fill (interface_colors[0], interface_colors[1], interface_colors[2]);
text ("x =", interface_x0, text_y);
text (x, interface_x0 + text_step_x, text_y);
text_y = text_y + text_step_y;
text ("y =", interface_x0, text_y);
text (y, interface_x0 + text_step_x, text_y);
text_y = text_y + text_step_y;
text ("Ячейка по х", interface_x0, text_y);
text (cell_x, interface_x0 + text_step_x, text_y);
text_y = text_y + text_step_y;
text ("Ячейка по y", interface_x0, text_y);
text (cell_y, interface_x0 + text_step_x, text_y);
text_y = text_y + text_step_y;
text ("Номер ячейки", interface_x0, text_y);
text (cell_number, interface_x0 + text_step_x, text_y);
text_y = text_y + text_step_y;
text ("Растений", interface_x0, text_y);
text (int(plant_number), interface_x0 + text_step_x, text_y);
plants [cell_x - 1] [cell_y - 1] = plants [cell_x - 1] [cell_y - 1] + plant_step;
plants [cell_x - 1] [cell_y - 1] = constrain(plants [cell_x - 1] [cell_y - 1], 0, );