Skip to content

Commit

Permalink
Print random seed and accept as option
Browse files Browse the repository at this point in the history
  • Loading branch information
iangreenleaf committed Apr 4, 2013
1 parent 4dee2f7 commit 3f31d20
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions bin/rtanque
Expand Up @@ -26,7 +26,9 @@ LONGDESC
method_option :gui, :default => true, :type => :boolean, :banner => 'false to run headless'
method_option :gc, :default => true, :type => :boolean, :banner => 'disable GC (EXPERIMENTAL)'
method_option :quiet, :aliases => '-q', :default => false, :type => :boolean, :banner => 'disable chatter'
method_option :seed, :default => Kernel.srand, :type => :numeric, :banner => 'random number seed value'
def start(*brain_paths)
Kernel.srand(options[:seed])
runner = RTanque::Runner.new(options[:width], options[:height], options[:max_ticks])
brain_paths.each { |brain_path|
begin
Expand Down
2 changes: 1 addition & 1 deletion lib/rtanque/heading.rb
Expand Up @@ -59,7 +59,7 @@ def self.delta_between_points(from_point, from_point_heading, to_point)
end

def self.rand
self.new(Float.send(:rand) * FULL_ANGLE)
self.new(Kernel.rand * FULL_ANGLE)
end

attr_reader :radians
Expand Down

0 comments on commit 3f31d20

Please sign in to comment.