3 # $Id: objinst-ruby.code,v 1.4 2004/11/13 07:42:25 bfulgham Exp $
4 # http://www.bagley.org/~doug/shootout/
5 # with help from Aristarkh Zagorodnikov
8 def initialize(start_state)
22 class NthToggle < Toggle
23 def initialize(start_state, max_counter)
25 @count_max = max_counter
31 if @counter >= @count_max
39 n = 1500000 # (ARGV.shift || 1).to_i
43 toggle.activate.value ? 'true' : 'false'
49 ntoggle = NthToggle.new 1, 3
51 ntoggle.activate.value ? 'true' : 'false'
54 ntoggle = NthToggle.new 1, 3