Matthias R
12/02/2019, 2:41 PMimport java.util.Arrays
object MineCraft {
@JvmStatic
fun main(args:Array<String>) {
val arrayWidth = Integer.parseInt(args[0])
val minecraftarray = Array(arrayWidth, {CharArray(arrayWidth)})
for (x in minecraftarray.indices)
{
val blockLength = Integer.parseInt(args[x + 1])
for (y in 0 until blockLength)
{
minecraftarray[x][y] = 'x'
}
}
Arrays.stream(minecraftarray).forEach(({ println(it) }))
}
}
the codes output is: xxxxx
xxx
xxxxxxx
xx
xxxxxx
xxxx
xxxxx
xxxxxxxxx
x
xx
Question: How can I make the output rotate by 90 degrees counter-clockwise?