All pastes #812575 Raw Edit

Untitled

public ruby v1 · immutable
·published 2007-12-11 21:47 UTC
rendered paste body
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 endclass Screenenda = Array2d.new(3,3)a.print