Text abacus illustrations
Txt-abacus is a simple python 3 module I wrote to cover my own needs for illustrating abacus diagrams on my jccAbacus website. The diagrams are based on text using a monospaced font instead of graphics, so the result is not particularly beautiful but it is lightweight, allowing a large number of diagrams to be included in a document without taking up too much disk space.
A 2:5 soroban/suanpan diagram |
Initially intended to draw diagrams of a 2:5 abacus with 13 rods with the possibility of a suspended upper bead (Kenshu, Xuánzhū 懸珠), it now allows drawing diagrams of abacus types 1:4, 1:5, 2:5 and 3:5 with up to 26 rods. Additionally, you can draw 1:5 type diagrams with a suspended lower bead. It also allows you to choose between four black/white schemes for set/unset beads, as well as the option to suppress the side borders.
The module only defines a user function sw_print which, among other arguments, receives a list of codes, one for for each column. Each code is a two-digit integer, the one on the left is the number of upper set beads (and can be omitted if it is zero) and the one on the right the number of lower set beads (with the exception of atype = '1:5s' where digits 6-9 are used to encode the lower suspended bead).
You can see a demo of these types of diagrams in this PDF document.
You can download the software from GitHub (Click on the "Code" button). It is under a Creative Commons Zero v1.0 Universal license that I am unable to distinguish from the Public Domain.
No comments:
Post a Comment