(OLD) (ARCHIVED) Puppy Linux Discussion Forum Forum Index (OLD) (ARCHIVED) Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info

This forum can also be accessed as http://oldforum.puppylinux.com
It is now read-only and serves only as archives.

Please register over the NEW forum
https://forum.puppylinux.com
and continue your work there. Thank you.

 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups    
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Fri 26 Feb 2021, 02:34
All times are UTC - 4
 Forum index » Off-Topic Area » Programming
fig 2.9 in tahr
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies. View previous topic :: View next topic
Page 1 of 1 [2 Posts]  
Author Message
learnhow2code

Joined: 12 Jun 2016
Posts: 1015

PostPosted: Tue 14 Jun 2016, 01:49    Post subject:  fig 2.9 in tahr  

so ive been running tahr and it has python 2 already installed. that means i can run fig 2.9 in it.

what is fig 2.9? a compiler i wrote that translates from a language called "fig" to python.

here is a fig program:

Code:
#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


here is how to install fig29:

* tar -xvf fig.tar
* copy the file fig29 to /usr/bin
* chmod +x /usr/bin/fig29

here is how to use fig:

Code:
# at the command line:
fig circles.fig
# (fig translates the file to circles.fig.py)
./circles.fig.py


fig29 is attached to this post.

translator is public domain and requires no other files than the ones tahr provides.

docs (public domain) and example scripts (also public domain) are available if anyone is interested.
fig.tar
Description 
tar

 Download 
Filename  fig.tar 
Filesize  10.05 KB 
Downloaded  134 Time(s) 
Back to top
View user's profile Send private message 
learnhow2code

Joined: 12 Jun 2016
Posts: 1015

PostPosted: Tue 14 Jun 2016, 02:02    Post subject:  

attached is the circles program running in a term
circles.png
 Description   
 Filesize   114.84 KB
 Viewed   152 Time(s)

circles.png

Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 1 of 1 [2 Posts]  
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies. View previous topic :: View next topic
 Forum index » Off-Topic Area » Programming
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 1.4906s ][ Queries: 12 (1.4301s) ][ GZIP on ]