Skip to content

Instantly share code, notes, and snippets.

@federico-pepe
Last active February 19, 2017 13:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save federico-pepe/015bafb250514e37c5c9565ae82b9785 to your computer and use it in GitHub Desktop.
Save federico-pepe/015bafb250514e37c5c9565ae82b9785 to your computer and use it in GitHub Desktop.
Array bidimensionali e scacchi
/*
* Array bidimensionali e scacchi
* Federico Pepe, 19.02.2017
* http://blog.federicopepe.com/processing
*/
int[][] scacchiera = {
{1, 0, 1, 0, 1, 0, 1, 0},
{0, 1, 0, 1, 0, 1, 0, 1},
{1, 0, 1, 0, 1, 0, 1, 0},
{0, 1, 0, 1, 0, 1, 0, 1},
{1, 0, 1, 0, 1, 0, 1, 0},
{0, 1, 0, 1, 0, 1, 0, 1},
{1, 0, 1, 0, 1, 0, 1, 0},
{0, 1, 0, 1, 0, 1, 0, 1} };
void setup() {
size(480, 480);
int rows = 8;
int cols = 8;
for (int i = 0; i < rows; i++) {
for(int j = 0; j < cols; j++) {
if(scacchiera[i][j] == 0) {
fill(0);
} else {
fill(255);
}
rect(i*60, j*60, 60, 60);
}
}
}
void draw() {
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment