xxxxxxxxxx
33
// Hi-jacking Han's worksheet sketch
let col, colW;
let row, rowH;
function setup() {
createCanvas(500, 500);
colW = 50;
rowH = 50;
}
function draw() {
background(220);
for (col = 0; col <= 10; col ++){
for (row = 0; row<= 10; row ++){
// Write my own add numbers
let rc = addNumbers(row, col);
if (rc % 2 == 1){
fill('black');
}else{
fill('white');
}
rect(col*colW, row*rowH, colW, rowH);
}
}
}
// Add 2 numbers together
function addNumbers(i, j) {
console.log(i + j);
let total = i + j;
return total;
}