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. figsp.fig is one of the early programs that use this function.
[img]figsp.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 = "doublespiral 2017 mn"
function rgbcolour r g b c
python
figcgapal[c] = (r, g, b)
fig
fig
v 1
c 400
w 3.14159 divby 2
function radians a
x a times 3.141592653589793 divby 180 return x
fig
for r 490 110 -.50
e w minus 0.00413367105263 swap e w # 3.14159 / 4 / (490 - 300)
for p 1 360 .5
e w cos times 380 divby 1 int
rc r divby 2 int
rd 256 minus rc rgbcolour rc 0 rc 11
x p radians x times 2 cos times e plus c int
y p radians y times 2 sin times e plus r minus 50 int
m 6.28 plus 1.57 divby 108.503 divby 2
now v plus m swap now v
rc r #divby 4 int mod 2
iftrue rc
now v times 2 int mod 2 times 11 pset x y now
y2 y minus 1 pset x y2 now
fig
next
now display
next
now display lineinput
home: [lit]https://freesoftwareresistance.neocities.org[lit]