I have the following code and I want to achieve the final picture. Can anyone help me to complete it?
(this is not homework or anything like that, I am learning at home through examples.)
float width_columns, height_rows;
PFont f;
int[][] numbers = {{10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}};
void setup() {
size(800, 600);
float num[][]= new float[width_columns][height_columns];
for (int i=0; i<numbers.length; i++){
for (int j=0; j<numbers[i].length; j++){
if(numbers[i][j] !=0){
num= + 1;
}
}
}
void draw() {
background(100, 0, 100);
f = createFont("Arial", 28, true);
textFont(f, 18);
height_rows = height/numbers.length;
width_columns = width/numbers[0].length;
for (int i = 0; i < numbers.length; i++) {
for (int j = 0; j < numbers[i].length; j++) {
text(numbers[i][j], j*width_columns + width_columns/4, i*height_rows + height_rows/2);
}
}
}