Hello all. I'm a bit of a sudoku fan and so decided I would try to write a program to solve them. However, I've run into a bit of a problem. I'm trying to write a method that will seperate the sudoku (stored in an array) into columns, rows, and squares. The columns and rows are working fine, but the squares portion of the method is not.

The code reads:
------------------------------------------------------------
Code:
 def seperate(sudoku)
# First Assignments
columns, rows, squares = Array.new, Array.new, Array.new
columns[0], rows[0], squares[0] = nil, nil, nil
keeper1 = 0
9.times do # First "do" - repeats everything nine times so as to insert nine columns, rows, and squares.
keeper2 = keeper1
keeper1 = keeper1 + 1
column, square, row = Array.new, Array.new, Array.new
9.times do # Columns
column.push sudoku[keeper2]
keeper2 = keeper2 + 9
end
columns.push column
keeper2 = (keeper1 - 1) * 9
9.times do # Rows
row.push sudoku[keeper2]
keeper2 = keeper2 + 1
end
rows.push row
if keeper1 == 1 or 2 or 3
keeper2 = (keeper1 - 1) * 3
elsif keeper1 == 4 or 5 or 6
keeper2 = (keeper1 - 4) * 3 + 27
elsif keeper1 == 7 or 8 or 9
keeper2 = (keeper1 - 7) * 3 + 54
end
keeper3 = 0
9.times do # Squares
square.push sudoku[keeper2]
keeper3 = keeper3 + 1
if keeper3 == 1 or 2 or 4 or 5 or 7 or 8
keeper2 = keeper2 + 1
end
if keeper3 == 3 or 6
keeper2 = keeper2 + 7
end
end
squares.push square
end 
result = [columns[1,9], rows[1,9], squares[1,9]]
return result
end
-----------------------------------------------------------

I'm only getting 78 values in the square array instead of 81, though I cannot for the life of me see why. When I take the conditional bit out, I'm not getting the keeper2 values I expect. Can anybody offer some insights as to why this is hapenning?