# Rosetta Examples development

**URL:** <https://discourse.processing.org/t/rosetta-examples-development/18945>\
**Category:** Development\
**Created:** [March 23, 2020, 8:04pm UTC](https://discourse.processing.org/t/rosetta-examples-development/18945 "2020-03-23T20:04:11Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![jeremydouglass](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jeremydouglass/32/20_2.png) [@jeremydouglass](https://discourse.processing.org/u/jeremydouglass)\
**Post date:** [March 23, 2020, 8:04pm UTC](https://discourse.processing.org/t/rosetta-examples-development/18945/1 "2020-03-23T20:04:11Z")

</div>

We have a great development chat happening on the Rosetta Examples release announcement thread – so I’m moving all that discussion here so that it can continue.

The idea is to make the other thread announcements-only so that it only updates periodically.

> **[jeremydouglass/rosetta\_examples\_p5](https://github.com/jeremydouglass/rosetta_examples_p5/)**
>
> Example set from Rosetta Code for P5 (Processing). Contribute to jeremydouglass/rosetta\_examples\_p5 development by creating an account on GitHub.

---

<div class="post-metadata">

**Author:** ![kll](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kll/32/964_2.png) [@kll](https://discourse.processing.org/u/kll)\
**Post date:** [December 18, 2019, 2:09am UTC](https://discourse.processing.org/t/rosetta-examples-development/18945/2 "2019-12-18T02:09:58Z")

</div>

thanks, what i see here in PDE is

 ![examples_NO_update](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/7/722754a6cd261e5f89aaf133b3cabffb2077020a.png)

should i `Remove` and install again?

* * *

OK remove & install (0.7) works and gives (0.8)

---

<div class="post-metadata">

**Author:** ![Chrisir](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/chrisir/32/45_2.png) [@Chrisir](https://discourse.processing.org/u/Chrisir)\
**Post date:** [December 18, 2019, 11:26am UTC](https://discourse.processing.org/t/rosetta-examples-development/18945/3 "2019-12-18T11:26:57Z")

</div>

The guy’s name is

- Sieve of Eratosthenes

---

<div class="post-metadata">

**Author:** ![jeremydouglass](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jeremydouglass/32/20_2.png) [@jeremydouglass](https://discourse.processing.org/u/jeremydouglass)\
**Post date:** [December 19, 2019, 6:18pm UTC](https://discourse.processing.org/t/rosetta-examples-development/18945/4 "2019-12-19T18:18:55Z")

</div>

> [@Chrisir](#):
>
> Eratosthenes

Yes, ha, thanks so much – caught that just the day before you did.

> <https://github.com/jeremydouglass/rosetta_examples_p5/commit/b2beedae0849dec5d8e781e6a043e724459e3652>
>
> \[Erotosthenes -\> Eratosthenes\]

---

<div class="post-metadata">

**Author:** ![jeremydouglass](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jeremydouglass/32/20_2.png) [@jeremydouglass](https://discourse.processing.org/u/jeremydouglass)\
**Post date:** [December 19, 2019, 6:55pm UTC](https://discourse.processing.org/t/rosetta-examples-development/18945/5 "2019-12-19T18:55:05Z")

</div>

> [@kll](#):
>
> remove & install (0.7) works and gives (0.8)

I **think** that the Contributions Manager doesn’t re-load its sources immediately – and for that reason it can take a while for it to pick up a change, even if you restart PDE. I’m not sure, though. But yes, forcing a manual install will always work.

---

<div class="post-metadata">

**Author:** ![noel](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/noel/32/213_2.png) [@noel](https://discourse.processing.org/u/noel)\
**Post date:** [February 24, 2020, 7:04pm UTC](https://discourse.processing.org/t/rosetta-examples-development/18945/6 "2020-02-24T19:04:16Z")

</div>

I have added the Bitmap/Bézier curves/Cubic task [here.](http://rosettacode.org/wiki/Bitmap/B%C3%A9zier_curves/Cubic#Processing)  
I followed your suggestion and along the strict task I also posted a visualizer code and a link to OpenProcessing to run it on line.  
When posting a task code on the Rosetta page, one could get lost, because you really have to edit someone else page right on the top. Somewhat strange but that"s how to do it. Also the [help/start page](https://www.rosettacode.org/wiki/Help:Adding_a_new_programming_example) is not immediately visible. Unfortunately Rosetta"s home page is not editable, so I edited some other pages adding the link.

.

---

<div class="post-metadata">

**Author:** ![jeremydouglass](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jeremydouglass/32/20_2.png) [@jeremydouglass](https://discourse.processing.org/u/jeremydouglass)\
**Post date:** [February 24, 2020, 11:40pm UTC](https://discourse.processing.org/t/rosetta-examples-development/18945/7 "2020-02-24T23:40:24Z")

</div>

Thank you, @noel !

I’ll commit those sketches to the github repo and include the credit to your username. Let me know if you would prefer a full name or something else…

---

<div class="post-metadata">

**Author:** ![noel](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/noel/32/213_2.png) [@noel](https://discourse.processing.org/u/noel)\
**Post date:** [February 25, 2020, 2:52am UTC](https://discourse.processing.org/t/rosetta-examples-development/18945/8 "2020-02-25T02:52:13Z")

</div>

> [@jeremydouglass](#):
>
> include the credit

Actually, I would like to keep rosetta’s habit of using no signing at all, to maintain the possibility of changing/improving by others. Afterall it is just basic code.

---

<div class="post-metadata">

**Author:** ![monkstone](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/monkstone/32/64_2.png) [@monkstone](https://discourse.processing.org/u/monkstone)\
**Post date:** [February 25, 2020, 2:55pm UTC](https://discourse.processing.org/t/rosetta-examples-development/18945/9 "2020-02-25T14:55:35Z")

</div>

I have a solution for the dragon fractal, based on contextfreeart, that you might find interesting? Jeremy Ashkenas created context free art DSL for ruby-processing that I have taken forward for JRubyArt:-

```ruby
require 'cf3'
 
INV_SQRT = 1 / Math.sqrt(2)
 
def setup_the_dragon
  @dragon = ContextFree.define do
    shape :start do
      dragon alpha: 1
    end
 
    shape :dragon do
      square hue: 0, brightness: 0, saturation: 1, alpha: 0.02
      split do
        dragon size: INV_SQRT, rotation: -45, x: 0.25, y: 0.25
        rewind
        dragon size: INV_SQRT, rotation: 135, x: 0.25, y: 0.25
        rewind
      end
    end
  end
end
 
def settings
  size 800, 500
end
 
def setup
  sketch_title 'Heighway Dragon'
  setup_the_dragon
  draw_it
end
 
def draw_it
  background 255
  @dragon.render :start, size: width * 0.8, stop_size: 2,
                         start_x: width / 3, start_y: height / 3.5
end

```

 ![dragon](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/a/a4c17af0a519c52401aed68abff50ad86a63eafc.png)

---

<div class="post-metadata">

**Author:** ![noel](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/noel/32/213_2.png) [@noel](https://discourse.processing.org/u/noel)\
**Post date:** [February 25, 2020, 3:38pm UTC](https://discourse.processing.org/t/rosetta-examples-development/18945/10 "2020-02-25T15:38:12Z")

</div>

Could you please describe what, in your opinion, are the advantages in using JRubyArt?

---

<div class="post-metadata">

**Author:** ![monkstone](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/monkstone/32/64_2.png) [@monkstone](https://discourse.processing.org/u/monkstone)\
**Post date:** [February 25, 2020, 4:15pm UTC](https://discourse.processing.org/t/rosetta-examples-development/18945/11 "2020-02-25T16:15:25Z")

</div>

JRubyArt is probably best for people familiar with ruby, who want to explore generative art. However there must be people like myself who had learned java, tried processing and then discovered ruby-processing (precursor to JRubyArt) that choose to learn ruby as an interesting alternative to java (_it got me hooked_). Ruby is a language that from the outset has been designed to [make programmers happy](https://en.wikipedia.org/wiki/Ruby_(programming_language)). Ruby is also [good for creating DSL](https://thoughtbot.com/blog/writing-a-domain-specific-language-in-ruby).

---

<div class="post-metadata">

**Author:** ![noel](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/noel/32/213_2.png) [@noel](https://discourse.processing.org/u/noel)\
**Post date:** [February 25, 2020, 7:10pm UTC](https://discourse.processing.org/t/rosetta-examples-development/18945/12 "2020-02-25T19:10:09Z")

</div>

[Here](https://www.rosettacode.org/wiki/Dragon_curve#Processing) is the p5 sketch for Dragon Curve as simple as possible by using solely translation and rotation.

---

<div class="post-metadata">

**Author:** ![monkstone](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/monkstone/32/64_2.png) [@monkstone](https://discourse.processing.org/u/monkstone)\
**Post date:** [February 25, 2020, 8:06pm UTC](https://discourse.processing.org/t/rosetta-examples-development/18945/13 "2020-02-25T20:06:23Z")

</div>

Nice! I converted your sketch for JRubyArt:-

```ruby
attr_reader :len, :gen

def setup
  sketch_title 'Heighway Dragon'
  background(0, 0, 255)
  translate(170, 170)
  stroke(255)
  @len = 3
  @gen = 14
  turn_left(len, gen)
end

def turn_right(len, gen)
  return draw_line(len) if gen.zero?

  turn_left(len, gen - 1)
  rotate(90.radians)
  turn_right(len, gen - 1)
end

def draw_line(len)
  line(0, 0, 0, -len)
  translate(0, -len)
end

def turn_left(len, gen)
  return draw_line(len) if gen.zero?

  turn_left(len, gen - 1)
  rotate(-90.radians)
  turn_right(len, gen - 1)
end

def settings
  size(700, 600)
end

```

 ![dragon2](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/0/092dc6122602d5a85a29d4f113395db1a7602261.png)

---

<div class="post-metadata">

**Author:** ![noel](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/noel/32/213_2.png) [@noel](https://discourse.processing.org/u/noel)\
**Post date:** [February 26, 2020, 11:55am UTC](https://discourse.processing.org/t/rosetta-examples-development/18945/14 "2020-02-26T11:55:10Z")

</div>

Ruby is much better represented on the Rosetta site than as P5  
There is another curve not present in both languages.  
[Here](https://www.rosettacode.org/wiki/Koch_curve#Processing) is a p5 “Koch Curve” (rotate/translate) sketch.  
What would be a Ruby (not rotate/translate) version.

---

<div class="post-metadata">

**Author:** ![monkstone](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/monkstone/32/64_2.png) [@monkstone](https://discourse.processing.org/u/monkstone)\
**Post date:** [February 26, 2020, 2:08pm UTC](https://discourse.processing.org/t/rosetta-examples-development/18945/15 "2020-02-26T14:08:10Z")

</div>

I already have an [animated example](https://github.com/ruby-processing/JRubyArt-examples/blob/master/processing_app/topics/lsystems/koch_fractal.rb) which uses this [library](https://github.com/ruby-processing/JRubyArt-examples/blob/master/processing_app/topics/lsystems/library/koch/koch.rb) which is stored locally. The library should be stored in a folder `library/library_name` and with filename `library_name.rb` (_only recently fixed_).

---

<div class="post-metadata">

**Author:** ![noel](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/noel/32/213_2.png) [@noel](https://discourse.processing.org/u/noel)\
**Post date:** [February 26, 2020, 2:17pm UTC](https://discourse.processing.org/t/rosetta-examples-development/18945/16 "2020-02-26T14:17:44Z")

</div>

I’ve tried to find an online Ruby compiler but none of them accepts uploading a lib file. So I can’t visualize the outcome.

---

<div class="post-metadata">

**Author:** ![villares](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/villares/32/3166_2.png) [@villares](https://discourse.processing.org/u/villares)\
**Post date:** [March 17, 2020, 3:10am UTC](https://discourse.processing.org/t/rosetta-examples-development/18945/17 "2020-03-17T03:10:15Z")

</div>

I have ported it to Processing Python 🙂

```python
"""
Dragon Curve https://www.rosettacode.org/wiki/Dragon_curve#Processing
 2020-02 Noel
 2020-03 Alexandre Villares (Python Mode)
Task: Create and display a dragon curve fractal.
https://en.wikipedia.org/wiki/Dragon_curve
(You may either display the curve directly or write it to an image file.)
For some brief notes the algorithms used and how they might suit various languages,
see the Rosetta Code task page.
"""

l = 3
ints = 13

def setup():
  size(700, 600)
  background(0, 0, 255)
  translate(150, 100)
  stroke(255)
  turn_left(l, ints)
  turn_right(l, ints)

def turn_right(l, ints):
    if ints == 0:
        line(0, 0, 0, -l)
        translate(0, -l)
    else:
        turn_left(l, ints - 1)
        rotate(radians(90))
        turn_right(l, ints - 1)
  
def turn_left(l, ints):
    if ints == 0:
        line(0, 0, 0, -l)
        translate(0, -l)
    else:
        turn_left(l, ints - 1)
        rotate(radians(-90))
        turn_right(l, ints - 1)

```

---

<div class="post-metadata">

**Author:** ![villares](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/villares/32/3166_2.png) [@villares](https://discourse.processing.org/u/villares)\
**Post date:** [March 19, 2020, 1:00am UTC](https://discourse.processing.org/t/rosetta-examples-development/18945/18 "2020-03-19T01:00:00Z")

</div>

@jeremydouglass you are a true wizard aren’t you! You have fixed all my messed up edits and categories and sub-categories and all things at [https://rosettacode.org](https://rosettacode.org) thank you so much! 😃

---

<div class="post-metadata">

**Author:** ![jeremydouglass](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jeremydouglass/32/20_2.png) [@jeremydouglass](https://discourse.processing.org/u/jeremydouglass)\
**Post date:** [March 19, 2020, 1:11am UTC](https://discourse.processing.org/t/rosetta-examples-development/18945/19 "2020-03-19T01:11:33Z")

</div>

Nonsense – your sketches were all beautiful clean code, and that’s what counts. Happy to help hash out the arcane mediawiki issues.

---

<div class="post-metadata">

**Author:** ![monkstone](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/monkstone/32/64_2.png) [@monkstone](https://discourse.processing.org/u/monkstone)\
**Post date:** [March 19, 2020, 7:51am UTC](https://discourse.processing.org/t/rosetta-examples-development/18945/20 "2020-03-19T07:51:33Z")

</div>

@jeremydouglass Yeah thanks for fixing mediawiki with JRubyArt at [https://rosettacode.org](https://rosettacode.org). I’ve just posted my Color Wheel submission, somewhat based on Processing version, however I’m very proud of JRubyArt grid functionality:-

```ruby
def settings
  size(300, 300)
end

def setup
  sketch_title 'Color Wheel'
  background(0)
  radius = width / 2.0
  center = width / 2
  grid(width, height) do |x, y|
    rx = x - center
    ry = y - center
    sat = Math.hypot(rx, ry) / radius
    if sat <= 1.0
      hue = ((Math.atan2(ry, rx) / PI) + 1) / 2.0
      color_mode(HSB)
      col = color((hue * 255).to_i, (sat * 255).to_i, 255)
      set(x, y, col)
    end
  end
end

```

[Next page](https://discourse.processing.org/t/rosetta-examples-development/18945.md?page=2)
