0

I am making a hashi puzzle game. I am using a 2D array for the game board with the number of links as the int in the array. I am iterating through the array twice. What would be the best way to output an image saved into the drawable folder onto the canvas in the position it is meant to be?

int gameBoard[][] = {{1, 0, 1, 0, 0}, {0, 2, 0, 0, 2}, {2, 0, 3, 0, 1}, {0, 0, 0, 0, 0}, {0, 0, 2, 0, 2}};

protected void onDraw(Canvas canvas) {
    canvas.drawColor(Color.WHITE);
    //i index of the row, there are 5 rows so loop through them all
    for (int i = 0; i < 5; i++)
        for (int R=0; 5 > R; R++) {
            //j is the position of an element in the row, we have 5.
            if (gameBoard[i][R] == 1) {
                // what here?

            }


        }
    }
}

0 Answers0