fig 2.9 with puppy: “tahr”

its years now since i used puppy linux, and the way its developed has somewhat changed (…not too much.)

puppy linux “tahr” includes python 2 out of the box, so i thought id run fig in it. heres what you do:

you may want a script to run, so here is one i posted for a demo:

#text mode: 
#### license: creative commons cc0 1.0 (public domain) 
#### http://creativecommons.org/publicdomain/zero/1.0/ 
now display 
function circle x y r c 
    cr r  int  plus 1 
    p -3.14159 
    try 
        rcpr 1 divby r 
    except 
        rcpr .005 
    resume 
    while 
        now p plus rcpr swap now p 
        ifmore p 3.14159 
            break 
            fig 
        cosx p  cos  times cr  plus x  int 
        siny p  sin  times cr  plus y  int 
        now     pset cosx siny c 
        wend 
    fig 
x 
y 
r 
c 
xf = 1  
yf = 1  
rf = .5  
cf = 1 
try 
    while 
        now circle (x, y), r, c : sleep .01 
python 
    x = x + xf ; y = y + yf ; c = c + cf ; r = r + rf 
    if x < 1:    xf = 1  
    if x > 638/2:  xf = -1 
    if y < 1:    yf = 1  
    if y > 477/2:  yf = -1 
    if c < 1:    cf = 1  
    if c > 14:   cf = -1 
    if r < 1:    rf = .5  
    if r > 200/4:  rf = -.5 
    fig 
        wend 
except 
    now colortext 7 : highlight 0 : cls : system : end 
    resume 

 

  • copy the file to
    circles.fig
  • run
    fig circles.fig
  • fig will translate to
    circles.fig.py
  • run
    ./circles.fig.py

theres a bug in this program, if you have pygame installed. either comment out #

now display

… or add

display

to the right of this line:

now circle (x, y), r, c : sleep .01

the line “now display” will turn off automatic pixel updating, but the pixels wont be told to update. this is a non-issue in text mode, but in pygame it may not work properly if left un-altered.

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s