The Great Computer Language Shootout shootout.alioth.debian.org/

contributed by Gabriele Renzi

Methods
C
N
P
S
Class Public methods
new()
# File benchmark/bm_so_pidigits.rb, line 8
def initialize()
    @z = Transformation.new 1,0,0,1
    @x = Transformation.new 0,0,0,0
    @inverse = Transformation.new 0,0,0,0
end
Instance Public methods
consume(a)
# File benchmark/bm_so_pidigits.rb, line 33
def consume(a)
    @z.compose(a)
end
next!()
# File benchmark/bm_so_pidigits.rb, line 14
def next!
    @y = @z.extract(3)
    if safe? @y
        @z = produce(@y)
        @y
    else
        @z = consume @x.next!()
        next!()
    end
end
produce(i)
# File benchmark/bm_so_pidigits.rb, line 29
def produce(i)
    @inverse.qrst(10,-10*i,0,1).compose(@z)
end
safe?(digit)
# File benchmark/bm_so_pidigits.rb, line 25
def safe?(digit)
    digit == @z.extract(4)
end