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 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0],
[0, 1, 1, 1, 0, 0, 1, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0],
[1, 1, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 2, 2, 2, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 2, 2, 0, 0, 2, 2, 1, 2, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 2, 2, 2, 2, 0, 0, 2, 2, 1, 2, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0],
[0, 0, 0, 0, 0, 2, 2, 2, 2, 0, 0, 2, 1, 1, 2, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0],
[0, 0, 0, 0, 0, 2, 2, 1, 2, 0, 0, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 1, 0, 2]
startX = floor(random(25));
startY = floor(random(25));
amap[startY][startX] = "player1";
for(var row = 0; row < 25; row++) {
for(var column = 0; column < 25; column++) {
if(amap[row][column] == 0) {
} else if(amap[row][column] == 1) {
} else if(amap[row][column] == 2) {
} else if(amap[row][column] == player1) {
rect(46+column*19, 46+row*19, 18, 18);
m = setInterval(points, 1000);
triangle(280,0,230,20,330,20);
triangle(0,280,20,230,20,330);
triangle(280,565,230,545,330,545);
triangle(565,280,545,230,545,330);
text("Populate", 46, 539);
function isPlayerPiece(y, x)
return amap[y][x] == "player1";
function mousePressed() {
var x = floor(((mouseX+46)/19)-5);
var y = floor(((mouseY+46)/19)-5);
var leftIsPlayer = isPlayerPiece(y,x-1);
print("left: " + leftIsPlayer);
var rightIsPlayer = isPlayerPiece(y,x+1);
print("right: " + rightIsPlayer);
var topIsPlayer = isPlayerPiece(y+1,x);
print("top: " + topIsPlayer);
var bottomIsPlayer = isPlayerPiece(y-1,x);
print("bottom:" + bottomIsPlayer);
var centerIsPlayer = isPlayerPiece(y,x);
print("center:" + centerIsPlayer);
if(leftIsPlayer || rightIsPlayer || topIsPlayer || bottomIsPlayer) {
print("This tile is already player1");
print("No neighbouring tiles");