Look-and-say sequence: Difference between revisions
Content deleted Content added
→{{header|Frink}}: Removed confusing comment |
Not a robot (talk | contribs) Add Draco |
||
Line 1,689: | Line 1,689: | ||
=={{header|Delphi}}== |
=={{header|Delphi}}== |
||
See [https://rosettacode.org/wiki/Look-and-say_sequence#Pascal Pascal]. |
See [https://rosettacode.org/wiki/Look-and-say_sequence#Pascal Pascal]. |
||
=={{header|Draco}}== |
|||
<lang draco>\util.g |
|||
proc nonrec look_and_say(*char inp, outp) void: |
|||
char cur; |
|||
byte count; |
|||
channel output text outch; |
|||
open(outch, outp); |
|||
while cur := inp*; cur ~= '\e' do |
|||
count := 1; |
|||
while |
|||
inp := inp + 1; |
|||
inp* = cur |
|||
do |
|||
count := count + 1 |
|||
od; |
|||
write(outch; count, cur) |
|||
od; |
|||
close(outch) |
|||
corp |
|||
proc nonrec main() void: |
|||
[256] char buf1, buf2; |
|||
byte i; |
|||
byte LINES = 14; |
|||
CharsCopy(&buf1[0], "1"); |
|||
for i from 1 upto LINES do |
|||
writeln(&buf1[0]); |
|||
look_and_say(&buf1[0], &buf2[0]); |
|||
CharsCopy(&buf1[0], &buf2[0]) |
|||
od |
|||
corp</lang> |
|||
{{out}} |
|||
<pre>1 |
|||
11 |
|||
21 |
|||
1211 |
|||
111221 |
|||
312211 |
|||
13112221 |
|||
1113213211 |
|||
31131211131221 |
|||
13211311123113112211 |
|||
11131221133112132113212221 |
|||
3113112221232112111312211312113211 |
|||
1321132132111213122112311311222113111221131221 |
|||
11131221131211131231121113112221121321132132211331222113112211</pre> |
|||
=={{header|E}}== |
=={{header|E}}== |