digital literacy for everyone


[lit]

[generate-title]

[lit] fig is a multi-purpose educational language-- originally designed to offer 16 colours in the term window or vt, with a compatible 16-colour palette in a graphics window. in 2017, i decided that rather than extend the language, a simple function (rgbcolour) would allow 24-bit colour without any change to the language itself. floral is one of the earlier programs that use this function. [img]floral.fig.png[img] [fig] # 2019 mn # # Permission to use, copy, modify, and/or distribute this software for any # purpose with or without fee is hereby granted. # # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. proginf "floral 2017 mn" function rgbcolour r g b c python figcgapal[c] = (r, g, b) fig fig function qline c d e f g ## draw 4 lines, points go 2x2 ## (cheap but avoids gaps) now line c d e f g d2 d plus 1 f2 f plus 1 now line c d2 e f2 g c2 c plus 1 e2 e plus 1 now line c2 d2 e2 f2 g now line c2 d e2 f g fig while rf randint 35 105 ## radius sf rf divby 2 int ## range of radius change xmin rf plus sf xmax xmin times -1 plus 800 ymin rf plus sf ymax ymin times -1 plus 600 pc randint 5 15 ## petal count xc randint xmin xmax ## horiz location yc randint ymin ymax ## vert location while cr randint 32 248 cg randint 32 248 cb randint 32 248 #fewer greens and dingy colors greenish cr plus cb minus cg times -1 ifless greenish 0 ifmore cr 160 break fig ifmore cg 160 break fig ifmore cb 160 break fig fig wend now display for p -3.14159 3.14159 0.00076698974609375 # 3.14159 / 2**12 r p times pc sin times sf plus rf plus 7 x p cos times r plus xc int y p sin times r plus yc int now line x y xc yc 15 next for p -3.14159 3.14159 0.00076698974609375 # 3.14159 / 2**12 r p times pc sin times sf plus rf x p cos times r plus xc int y p sin times r plus yc int now rgbcolour cr cg cb 14 qline x y xc yc 14 next now display wend now lineinput
home: [lit]https://freesoftwareresistance.neocities.org[lit]