L-system: Difference between revisions

Added Gambas.
(Added C++ and Dart)
(Added Gambas.)
Line 183:
{{out}}
<pre>After 5 iterations there are 5 old rabbits and 3 young ones (MIMMIMIM)</pre>
 
==={{header|Gambas}}===
{{trans|FreeBASIC}}
<syntaxhighlight lang="vbnet">Public rules As String[] = ["I", "M", "M", "MI"]
 
Public Sub Main()
Dim s As String = "I"
Dim count As Integer = 5
For i As Integer = 0 To count
Print s
Dim nxt As String = ""
Dim j As Integer = 0
While j < Len(s)
Dim c As String = Mid(s, j + 1, 1)
Dim found As Boolean = False
Dim k As Integer = 0
While k <= rules.Max And Not found
If c = rules[k] Then
Dim rep As String = rules[k + 1]
found = True
Endif
k += 2
Wend
nxt &= If(found, rep, c)
j += 1
Wend
s = nxt
Next
End </syntaxhighlight>
{{out}}
<pre>Same as FreeBASIC entry.</pre>
 
==={{header|GW-BASIC}}===
Line 385 ⟶ 419:
<pre>Same as C++ entry.</pre>
 
==={{header|FreeBASIC}}===
L-system functionality as a Role that may be mixed in to a scalar.
 
2,169

edits