[macruby-changes] [3483] MacRuby/trunk/sample-macruby/Scripts/gcd/ring_buffer.rb

source_changes at macosforge.org source_changes at macosforge.org
Wed Feb 10 16:15:23 PST 2010


Revision: 3483
          http://trac.macosforge.org/projects/ruby/changeset/3483
Author:   ernest.prabhakar at gmail.com
Date:     2010-02-10 16:15:23 -0800 (Wed, 10 Feb 2010)
Log Message:
-----------
Run ring_buffer.rb over same ranges as original blog post

Modified Paths:
--------------
    MacRuby/trunk/sample-macruby/Scripts/gcd/ring_buffer.rb

Modified: MacRuby/trunk/sample-macruby/Scripts/gcd/ring_buffer.rb
===================================================================
--- MacRuby/trunk/sample-macruby/Scripts/gcd/ring_buffer.rb	2010-02-11 00:15:16 UTC (rev 3482)
+++ MacRuby/trunk/sample-macruby/Scripts/gcd/ring_buffer.rb	2010-02-11 00:15:23 UTC (rev 3483)
@@ -5,9 +5,9 @@
 require 'benchmark'
 require 'dispatch'
 
-DEBUG = true
+DEBUG = false
 
-N_NODES = DEBUG ? 1 : 3
+N_NODES = DEBUG ? 1 : 4
 M_MESSAGES = DEBUG ? 0 : 3
 
 class Node
@@ -37,7 +37,7 @@
     end
     
     def to_s
-        "##{@index}->[#{@successor.index}]@#{@current}"
+        "##{@index}->#{@successor.index}[#{@current}]"
     end
 end
 
@@ -76,12 +76,12 @@
   
 end
 
-0.upto N_NODES do |p|
+1.upto N_NODES do |p|
     n = 10**p
     ring = Ring.new n
     puts "\nRing of size #{n}:"
     puts "\t#{ring}" if DEBUG
-    0.upto(M_MESSAGES) do |q|
+    1.upto(M_MESSAGES) do |q|
       r = 10**q
       [r, 2*r, 5*r].each do |m|
           puts "#{m} message(s)" if DEBUG
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20100210/aa688de4/attachment.html>


More information about the macruby-changes mailing list