Skip to content

Commit

Permalink
replace !gsub with gsub
Browse files Browse the repository at this point in the history
  • Loading branch information
monkstone committed Mar 6, 2020
1 parent 877d592 commit c7ad2ad
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion processing_app/topics/lsystems/csplant.rb
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def render
specular(255, 255, 255)
shininess(1.0)
repeat = 1
production.each_char do |ch|
production.scan(/./) do |ch|
case ch
when 'F'
translate(0, len / -2, 0)
Expand Down
2 changes: 1 addition & 1 deletion processing_app/topics/lsystems/david_tour.rb
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def create_grammar(gen)
def translate_rules(prod)
swap = false
[].tap do |points| # An array to store lines as a flat array of points
prod.scan(/./) do |ch|
prod.scan(/./) do |ch||
case ch
when 'F'
points << xpos << ypos << (@xpos += draw_length * Math.cos(theta)) << (@ypos -= draw_length * Math.sin(theta))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def generate(repeat = 0) # repeat iteration grammar rules

def new_production(prod) # single iteration grammar rules
@idx = -1
prod.gsub!(/./) do |ch|
prod.gsub(/./) do |ch|
get_rule(prod, ch)
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def add_rule(pre, rule, weight = 1.0) # default weighting 1
end

def new_production(prod) # note the use of gsub!
prod.gsub!(/./) do |ch|
prod.gsub(/./) do |ch|
rule?(ch) ? stochastic_rule(srules[ch]) : ch
end
end
Expand Down
2 changes: 1 addition & 1 deletion processing_app/topics/lsystems/mpeano.rb
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def generate(gen)

def translate_rules(prod)
[].tap do |points| # An empty array to store line vertices
prod.scan(/./) do |ch|
prod.scan(/./) do |ch||
case ch
when 'F'
points << xpos << ypos << (@xpos -= draw_length * cos(theta)) << (@ypos -= draw_length * sin(theta))
Expand Down
2 changes: 1 addition & 1 deletion processing_app/topics/lsystems/peano.rb
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def translate_rules(prod)
coss = ->(orig, alpha, len) { orig + len * DegLut.cos(alpha) }
sinn = ->(orig, alpha, len) { orig - len * DegLut.sin(alpha) }
[].tap do |pts| # An array to store line vertices as Vec2D
prod.scan(/./) do |ch|
prod.scan(/./) do |ch||
case ch
when 'F'
pts << vec.copy
Expand Down
2 changes: 1 addition & 1 deletion processing_app/topics/lsystems/three_d_tree.rb
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def initialize
end

def render
production.each_char do |ch|
production.scan(/./) do |ch
case ch
when 'F'
fill(0, 200, 0)
Expand Down

0 comments on commit c7ad2ad

Please sign in to comment.