I was thinking to re-implement xeyes in terminal, so drawing a circle is essential. It’s not hard, not even in using Bash plus bc, but I don’t really see the point to reinvent the eyes, therefore I stopped just after I was able to primitively draw a circle, like the following one:
11111111222222222 1111 2222 111 222 11 22 11 22 11 22 11 22 1 2 1 2 33 44 3 4 3 4 33 44 33 44 33 44 33 44 333 444 3333 4444 33333333444444444
You can view the codes in this Gist, which also includes a couple of variations. The one above uses and functions. In that Gist, there is another approach by using , that also gives acceptable results.
Because bc is called many times, the speed is noticeable, at least to me. If using bc’s programming features and returning a series of calculated numbers at once, I am sure it would run much faster. But since I am not interested in continuing, so I didn’t do anything.
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.