Last active
February 19, 2017 13:03
-
-
Save federico-pepe/015bafb250514e37c5c9565ae82b9785 to your computer and use it in GitHub Desktop.
Array bidimensionali e scacchi
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* 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