Checking in a collection?

n/a

You can calculate indices like this:

for(iSquare <- 0 until 9) {
val squareBegin = 3iSquare
for(x <- 0 until 3; y <- 0 until 3) {
val index = squareBegin + x + 9
y
println(index) // or whatever
}

}

I think Markdown ate some of your code

Worst forum software ever.