https://habrahabr.ru/sandbox/74790/
int p1_div = 200;
int p2_div = 200;
char p1map[][] = {
{'~','s','s','~','~','~','~','s','~','~'},
{'~','~','~','~','~','~','~','~','~','~'},
{'~','~','~','~','s','~','~','~','~','s'},
{'~','s','~','~','~','~','s','~','~','s'},
{'~','s','~','~','~','~','s','~','~','s'},
{'~','s','~','~','~','~','~','~','~','~'},
{'~','~','~','~','~','~','~','~','s','~'},
{'~','~','~','~','s','s','~','~','~','~'},
{'~','s','~','~','~','~','~','~','~','~'},
{'~','~','~','~','s','s','s','s','~','~'}
};
char p2map[][] = {
{'~','~','~','s','~','~','~','~','s','s'},
{'~','s','~','s','~','~','~','~','~','~'},
{'~','~','~','s','~','~','~','~','~','~'},
{'~','~','~','s','~','~','~','s','~','~'},
{'~','~','~','~','~','~','~','s','~','~'},
{'~','s','~','~','s','~','~','s','~','~'},
{'~','s','~','~','~','~','~','~','~','~'},
{'~','s','~','s','~','~','~','~','~','~'},
{'~','~','~','~','~','s','s','~','~','~'},
{'s','s','~','~','~','~','~','~','s','~'}
};
void setup()
{
size(500,500);
}
void draw()
{
int w = 10;
int h = 10;
rect(0,0,p1_div,p1_div);
rect(210,0,p2_div,p2_div);
for (int i=0;i<w;i++)
{
for (int j=0;j<h;j++)
{
char el1 = p1map[j][i] == 's' ? 's' : 'w';
char el2 = p2map[j][i] == 's' ? 's' : 'w';
if (el1 == 's') rect(i*20,j*20,20,20);
if (el2 == 's') rect(i*20+210,j*20,20,20);
}
}
}
|