Run-length encoding: Difference between revisions

Content added Content deleted
Line 2,205: Line 2,205:


<syntaxhighlight lang="easylang">
<syntaxhighlight lang="easylang">
proc encode in$ . out$ .
proc enc in$ . out$ .
out$ = ""
out$ = ""
for c$ in strchars in$
for c$ in strchars in$
Line 2,220: Line 2,220:
out$ &= cnt & c0$
out$ &= cnt & c0$
.
.
proc decode in$ . out$ .
proc dec in$ . out$ .
out$ = ""
out$ = ""
for h$ in strsplit in$ " "
for h$ in strsplit in$ " "
Line 2,229: Line 2,229:
.
.
.
.
call encode input r$
s$ = input
print r$
print s$
call decode input r$
call enc s$ s$
print r$
print s$
call dec s$ s$
print s$
#
#
input_data
input_data
WWWWWWWWWWWWBWWWWWWWWWWWWBBBWWWWWWWWWWWWWWWWWWWWWWWWBWWWWWWWWWWWWWW
WWWWWWWWWWWWBWWWWWWWWWWWWBBBWWWWWWWWWWWWWWWWWWWWWWWWBWWWWWWWWWWWWWW
12W 1B 12W 3B 24W 1B 14W


</syntaxhighlight>
</syntaxhighlight>