Run-length encoding: Difference between revisions

Content added Content deleted
(Undo revision 360776 by Aarde (talk))
Line 2,835: Line 2,835:
This gives RLE encoding for strings and RLE decoding for strings and arrays, e.g., for [[Conway's_Game_of_Life|Conway's Game of Life]]
This gives RLE encoding for strings and RLE decoding for strings and arrays, e.g., for [[Conway's_Game_of_Life|Conway's Game of Life]]
<syntaxhighlight lang=FutureBasic>
<syntaxhighlight lang=FutureBasic>

Dynamic a(1, 1) as Short // Self-fulfilling array, so don't need width and height



local fn encode( string as CFStringRef) as CFStringRef
local fn encode( string as CFStringRef) as CFStringRef
Line 2,878: Line 2,875:




local fn decode2D( string as CFStringRef ) // For Game of Life
local fn decode2D( string as CFStringRef )
Boolean a(500, 500) // Or larger to hold bigger objects
CFStringRef ch
CFStringRef ch
Short i, j, rl, f // Decoded char
Short i, j, rl, f // Decoded char