xxxxxxxxxx
g.fillOval(3 + 13*col, 3 + 13*row, 10, 10);
xxxxxxxxxx
private void drawPiece(Graphics g, int piece, int row, int col) {
// Draw a piece in the square at (row,col). The color
// is specified by the "piece" parameter, which should be
// either BLACK or WHITE.
if (piece == WHITE)
g.setColor(Color.white);
else
g.setColor(Color.black);
g.fillOval(3 + 13*col, 3 + 13*row, 10, 10);
}
xxxxxxxxxx
dirX dirY Why?
---- ---- --------------------------------
horizontal direction 1 0 Only x changes.
vertical direction 0 1 Only y changes.
first diagonal 1 1 Both x and y change.
second diagonal 1 -1 Change in opposing directions.