Euclidean rhythm: Difference between revisions

Added Asymptote
(Added various BASIC dialects (BASIC256, Chipmunk Basic, FreeBASIC, QBasic, Gambas, PureBasic, True BASIC andYabasic))
(Added Asymptote)
Line 72:
10010010
</pre>
 
=={{header|Asymptote}}==
<syntaxhighlight lang="Asymptote">int m = 5;
int n = 13;
 
string r[] = new string[n];
int a_pio = 1, a_fin = m;
int b_pio = m + 1, b_fin = n;
int a_pos, b_pos;
 
for (int i = 1; i <= m; ++i)
r[i] = "1";
for (int i = m + 1; i <= n; ++i)
r[i] = "0";
 
while (a_fin > a_pio && b_fin > b_pio) {
a_pos = a_pio;
b_pos = b_pio;
while (a_pos <= a_fin && b_pos <= b_fin) {
r[a_pos] += r[b_pos];
++a_pos;
++b_pos;
}
if (b_pos < b_fin)
b_pio = b_pos;
else {
b_pio = a_pos;
b_fin = a_fin;
a_fin = a_pos - 1;
}
}
 
string result = "";
for (int i = a_pio; i <= a_fin; ++i)
result += r[i];
for (int i = b_pio; i <= b_fin; ++i)
result += r[i];
 
write(result);</syntaxhighlight>
{{out}}
<pre>10010010</pre>
 
=={{header|BASIC}}==
2,169

edits