Revisions
-
rickhull revised this gist
Oct 11, 2011 . 1 changed file with 6 additions and 15 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,17 +1,8 @@ module DiceSet def self.roll(num) Array.new(num) { 1 + rand(6) } end end DiceSet.roll(20) -
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,18 +1,17 @@ class DiceSet < Array attr_reader :values def initialize @values = Array.new end def roll(number) number.times do @values << (1 + rand(6)) puts self.to_s puts "Numbers = #{self}" end end end -
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,4 @@ class DiceSet < Array def initialize @numbers = Array.new -
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,8 @@ class DiceSet def initialize @numbers = Array.new end def roll(number) number.times do @@ -8,4 +11,8 @@ def roll(number) puts "Numbers = #{@numbers}" end end def values self end end -
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,8 +1,11 @@ class DiceSet @numbers = Array.new def roll(number) number.times do @numbers << (1 + rand(6)) puts @numbers.length puts "Numbers = #{@numbers}" end end end -
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,8 @@ def roll(number) number.times do @numbers = Array.new @numbers << (1 + rand(6)) puts @numbers.length puts "Numbers = #{@numbers}" end end -
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,6 @@ def roll(number) number.times do numbers = Array.new numbers += 1 + rand(6) puts "Numbers = #{numbers}" end end