class Array2d def initialize(y, x) @test = "test" @length = y*x @height = y @width = x end print @test @arr = Array.new(@length) puts @length exit def calc(y,x) return y*@height+x end def yx(y, x) return @arr[calc(y,x)]; end def set(y, x, value) @arr[calc(y,x)] = value end def print 0.upto(@length) do |i| print @arr.at(i) print " " if i % x = 0 and x > 0 then print "\n" end end end end class Screen end a = Array2d.new(3,3) a.print