Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- val layer = Seq(1, 0, 0, 0, 1,
- 1, 0, 0, 0, 1,
- 1, 0, 0, 0, 1,
- 1, 0, 0, 0, 1,
- 1, 0, 0, 0, 1,
- 1, 0, 0, 0, 1,
- 1, 0, 0, 0, 1)
- val width = 5
- val layerArray: Seq[Seq[Int]] = layer.grouped(width).toSeq
- val height = layerArray.size
- layerArray(height - 1)(width - 1)
- (for {
- j <- 0 until Math.ceil(height / 2).toInt
- h <- 0 until height
- i <- 0 until Math.ceil(width / 2).toInt
- w <- 0 until width
- } yield layerArray(j)(w) == layerArray(height - 1 - j)(w) &&
- layerArray(h)(i) == layerArray(h)(width - 1 - i)).forall(identity)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement