using fig to implement a neat pattern

i found this program yesterday: pola bintang pascal | selamat datang. translator says its indonesian. i liked it so much, i made a version in fig:

#
# fig version of this lovely design:
#     https://derrysandyk001.wordpress.com/2016/02/20/pola-bintang-pascal/
# public domain

# i did not look at the code in that post to write 
# this program, i only looked at the picture and wrote
# code to do the same thing.

function pbp x
    p = 14 minus x divby 2
    ifmore p 0
        sp " " times p prints
        fig

    for p 1 x 1
        pr = "*" colortext p prints colortext 7
        next

    pr = "" print
    fig

pr1 = "2 4 6 8 10 12 14 14 14 14 14 14 14 14" 
pr2 = pr1 plus " 14 12 10 8 6 4 2" split pr2 " "

forin z pr2
    p = z int pbp p
    next

 

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