Skip to content
Snippets Groups Projects
Commit f0fc075a authored by pjs's avatar pjs
Browse files

minor tweaks to demos


Signed-off-by: default avatarpjs <pjs@alum.mit.edu>
parent 6d6cca3a
No related branches found
No related tags found
No related merge requests found
#!/usr/bin/env ruby #!/usr/bin/env ruby
# expand the $LOAD_PATH to find local library modules until such # expand the $LOAD_PATH to find local library modules until such
# time as this gets turned into a Ruby Gem. # time as SimpleKit gets turned into a Ruby Gem.
[File.expand_path(File.dirname(__FILE__), '../lib')].each do |new_location| [File.expand_path(File.dirname(__FILE__), '../lib')].each do |new_location|
$LOAD_PATH.unshift(new_location) unless $LOAD_PATH.include?(new_location) $LOAD_PATH.unshift(new_location) unless $LOAD_PATH.include?(new_location)
end end
......
...@@ -12,12 +12,12 @@ class MyModel ...@@ -12,12 +12,12 @@ class MyModel
def init def init
@x = 1 @x = 1
schedule(:increment, 1.0, 1, 97) schedule(:increment, rand, 1, 97)
end end
def increment(n, c) def increment(n, c)
@x += n @x += n
schedule(:increment, 1.5, @x, c + 1) schedule(:increment, 2.0 * rand, @x, c + 1)
printf "%f, %f, %c\n", model_time, @x, c printf "%f, %f, %c\n", model_time, @x, c
schedule(:halt, 0.0) if model_time > 10 schedule(:halt, 0.0) if model_time > 10
end end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment