I need to fill an 8×8 matrix just with 0.
I know it is possible to do the following:
board = arrayOf(
intArrayOf(0, 0, 0, 0, 0, 0, 0, 0),
intArrayOf(0, 0, 0, 0, 0, 0, 0, 0),
intArrayOf(0, 0, 0, 0, 0, 0, 0, 0),
intArrayOf(0, 0, 0, 0, 0, 0, 0, 0),
intArrayOf(0, 0, 0, 0, 0, 0, 0, 0),
intArrayOf(0, 0, 0, 0, 0, 0, 0, 0),
intArrayOf(0, 0, 0, 0, 0, 0, 0, 0),
intArrayOf(0, 0, 0, 0, 0, 0, 0, 0),
)
This time is just an 8×8 so it’s not too much work, but what if I have an 200×200 matrix, what should I do?
>Solution :
val board = Array(8) { IntArray(8) { 0 } }