View more

View more

View more

### Image of the Day Submit

IOTD | Top Screenshots

### The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.

# Putting pieces inside a board

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

22 replies to this topic

### #21concepts  Members

Posted 19 February 2013 - 02:05 PM

the problem has to do with the rotate method that doesn't update the shape...

do you know how i can fix this, because I don't know which method I have to change.

Edited by concepts, 19 February 2013 - 02:06 PM.

### #22concepts  Members

Posted 19 February 2013 - 07:33 PM

ok so the problem is in this:

public static boolean legalDown(int currentX, int currentY, int[][] board, int[][] shape)
{
int x = currentY+1;
int y = currentX;

//printArray(board);

if (x > 28)
{

return legalDownSpec(currentX, currentY, board, shape);

}

for (int row = 0; row < 4; row++)
{
for(int col = 0; col < 4; col++)
{

if (shape[row][col] == 1 && board[x+row][y+col] == 0)
{

}
else
{
if (shape[row][col] == 0 && board[x+row][y+col] == 1)
{

}
else
{

if (shape[row][col] ==0 && board[x+row][y+row] == 0)
{

}

else
{
System.out.println("NOT spec");

return false;
}
}
}
}
}

return true;
}

I get: notspec like 6 times when it should have been only 1; furthermore, it stops a block before it should... What is the problem? I need an expert here...

### #23concepts  Members

Posted 19 February 2013 - 08:01 PM

Can someone tell me how I can do this:

a = getContents();
b = board.getContents();

Inside of:

    public static boolean legalDown(int currentX, int currentY, int[][] board, int[][] shape)
{
int x = currentY+1;
int y = currentX;

printArray(board);

if (x > 28)
{

return legalDownSpec(currentX, currentY, board, shape);

}

for (int row = 0; row < 4; row++)
{
for(int col = 0; col < 4; col++)
{

if (shape[row][col] == 1 && board[x+row][y+col] == 0)
{

}
else
{
if (shape[row][col] == 0 && board[x+row][y+col] == 1)
{

}
else
{

if (shape[row][col] ==0 && board[x+row][y+row] == 0)
{

}

else
{
System.out.println("NOT spec");

return false;
}
}
}
}
}

return true;
}

I need to update the variables..., but I can't since the method is static, but doing so would fix the problem.

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.