xabacus - Abacus X widget
/usr/games/xabacus [-geometry
[{width}][x{height}][{+-}{xoff}[{+-}{yoff}]]] [-display [{host}]:[{vs}]]
[-[no]mono] [-[no]{reverse|rv}] [-{foreground|fg} {color}] [-{background|bg}
{color}] [-{border|bd} {color}] [-frame {color}] [-primaryBeadColor {color}]
[-leftAuxBeadColor {color}] [-rightAuxBeadColor {color}]
[-secondaryBeadColor {color}] [-highlightBeadColor {color}]
[-primaryRailColor {color}] [-secondaryRailColor {color}]
[-highlightRailColor {color}] [-lineRailColor {color}] [-bumpSound
{filename}] [-moveSound {filename}] [-dripSound {filename}] [-[no]sound]
[-delay msecs] [-[no]script] [-[no]demo] [-demopath {path}]
[-{demofont|demofn} {fontname}] [-{demoforeground|demofg} {color}]
[-[no]teach] [-[no]rightToLeftAdd] [-[no]rightToLeftMult] [-[no]lee] [-rails
{int}] [-leftAuxRails {int}] [-rightAuxRails {int}] [-[no]vertical]
[-colorScheme {int}] [-[no]slot] [-[no]diamond] [-railIndex {int}]
[-[no]topOrient] [-[no]bottomOrient] [-topNumber {int}] [-bottomNumber
{int}] [-topFactor {int}] [-bottomFactor {int}] [-topSpaces {int}]
[-bottomSpaces {int}] [-topPiece {int}] [-bottomPiece {int}]
[-topPiecePercent {int}] [-bottomPiecePercent {int}] [-shiftPercent {int}]
[-subdeck {int}] [-subbead {int}] [-[no]sign] [-decimalPosition {int}]
[-[no]group] [-groupSize {int}] [-[no]placeOnRail] [-[no]decimalComma]
[-base {int}] [-[no]eighth] [-anomaly {int}] [-shiftAnomaly {int}]
[-anomalySq {int}] [-shiftAnomalySq {int}] [-displayBase {int}]
[-[no]pressOffset] [-[no]romanNumerals] [-[no]latin] [-[no]ancientRoman]
[-[no]modernRoman]
[-{chinese|japanese|korean|russian|danish|roman|medieval|generic}]
[-{it|uk|fr}] [-version]
This is an implementation of the classic Chinese Abacus (Suanpan)
which has its origins in the 12th century.
The device has two decks. Each deck, separated by a partition,
normally has 13 rails on which are mounted beads. Each rail on the top deck
contains 1 or 2 beads, and each rod on the bottom deck contains 4 or 5
beads. Each bead on the upper deck has a value of five, while each bead on
the lower deck has value of one. Beads are considered counted, when moved
towards the partition separating the decks, i.e. to add a value of
one, a bead in the bottom deck is moved up, and to add a value of 5, a bead
in the top deck is moved down.
The basic operations of the abacus are addition and subtraction.
Multiplication can be done by mentally multiplying the digits and adding up
the intermediate results on the abacus. Division would be similar where the
intermediate results are subtracted. There are techniques like using your
thumb and forefinger which does not apply with mouse entry. Also with
multiplication, one can carry out calculations on different parts of the
abacus for scratch work, here it is nice to have a long abacus.
The pre-WWII Japanese Abacus (Soroban) (or Korean Jupan) is
similar to the Chinese Abacus but has only one bead per rail on the top
deck. The later Japanese Abacus was further simplified to have only 4 beads
per rail on the bottom deck.
The Roman Hand-Abacus predates the Chinese Abacus and is very
similar to the later Japanese Abacus, but seems to have fallen out of use
with the Fall of the Roman Empire (at least 3 are in existence). The Roman
Abaci are brass plates where the beads move in slots. In addition to the
normal 7 columns of beads, they generally have 2 special columns on the
right side. In two examples: the first special column was for 12ths (12
uncia (ounces) = 1 as) and had one extra bead in the bottom deck. Also the
last column was a combination of halves, quarters, and twelfths of an ounce
and had no beads in the top deck and 4 beads at the bottom (beads did not
have to come to the top to be counted but at one of 3 marked points where
the top bead was for halves, the next bead for quarters, and the last two
beads for twelfths). In another surviving example: the 2 special columns
were switched and the combination column was broken into 3 separate slots.
If available, decimal input is ignored.
The Russian Abacus was invented in the 17th century, here the
beads are moved from right to left. It has colored beads in the middle for
ease of use. Quarters represent 1/4 Rubles and are only present historically
on the Russian Abacus (Schoty). Some of the older Schoty have a extra place
for the 1/4 Kopek (quarter percent) as well as the 1/4 Ruble (quarter).
The Danish Abacus was used in the early 20th century in elementary
schools as a teaching aid.
The Medieval Counter is a primitive form of the abacus and was
used in Europe as late as the 1600s. It was useful considering they were
using it with Roman Numerals. This is similar to the Salamis Greek Tablet
from 4th or 5th Century BCE.
The Mesoamerican Nepohualtzintzin is a Japanese Abacus base 20.
The Mesoamericans had base 20 with the exception of the 3rd decimal place
where instead of 20*20=400 the third place marked 360 and the 4th place was
20*360, etc.. They independently created their own zero (only Babylon (base
60) and India (base 10) have done this) but the anomaly took away its true
power.
An easy way of figuring out time in seconds given hours, minutes,
and seconds, can be done on the abacus with special anomaly
"watch" settings.
The Chinese Solid-and-Broken-Bar System is a base 12 numbering
system and not really an abacus. When the abacus is setup in this way though
(topFactor 3, topNumber 3, bottomNumber 2, base 12, displayBase 12), it is
easy to relate the two.
The signed bead is an invention of the author, and is not present
on any historical abacus (to his knowledge) and is used to represent
negatives. "New & Improved" abacus models have two auxiliary
decks stacked above the principal deck that enable multiplication, division,
square-root, and cube-root computations to be performed with equal ease as
addition and subtraction (well, so I have read).
Click "mouse-left" button on a bead you want to
move. The beads will shift themselves to vacate the area of the column that
was clicked.
Click "mouse-right" button, or press
"C" or "c" keys, to clear the abacus.
Press "-" or "_" keys to
complement the beads on the rails.
Press "U" or "u" keys to undo
last move.
Press "R" or "r" keys to redo
the last undo.
Press "O" or "o" keys to toggle
the demo mode.
Press "$" key to toggle the teach mode.
In teach mode, "+" key toggles starting side to
sum, ""*" key toggles for starting side for
multiplicand.
Press "I" or "i" keys to
increment the number of rails. Press "D" or
"d" keys to decrement the number of rails.
Press "F" or "f" keys to switch
between Chinese, Japanese, Korean, Russian, Danish, Roman, and Medieval
formats. There is an extra "Generic" format, this allows one to
break some rules binding the other formats (for example, if one wanted more
beads on top deck than on bottom deck you would use this, in addition to
resource option changes).
Press "V" or "v" keys to toggle
Roman Nvmerals. (Pardon typo/humor, but ran out of letters).
Press "#" key to toggle place on rail for group
and decimal separators.
Press "(" key to toggle Ancient Roman Numerals
(when Roman Nvmerals is activated).
Press "~" key to toggle Latin Numerals (when
Roman Nvmerals and quarter beads or twelfth beads are activated).
Press "S" or "s" keys to toggle
the sign bead.
Press "T" or "t" keys to toggle
the availability of quarter beads. (Mutually exclusive to twelfth beads).
Intended for the Russian Abacus.
Press "L" or "l" keys to toggle
the availability of twelfth beads. (Mutually exclusive to quarter beads).
Intended for the Roman Abacus.
Press "P" or "p" keys to toggle
the availability of quarter percent beads. (Dependent on quarter beads (or
twelfth beads). Intended for the older Russian Abacus.
Press "B" or "b" keys to toggle
the availability of subdecks. (Dependent on twelfth beads (or quarter beads)
and Roman format). Intended for the Roman Abacus, where the lowest value of
two at bottom of the rightmost column of beads are a twelfth of the column
second from right.
Press "H" or "h" keys to toggle
the availability of subdecks. (Dependent on twelfth beads (or quarter beads)
and Roman format). Intended for the Roman Abacus, where the lowest value of
three at bottom of the rightmost column of beads are an eighth of the column
second from right.
Press "M" or "m" keys to switch
between it, uk, and fr museum formats.
Press ")" key to toggle Modern Numerals on frame
(when showing Roman Hand Abacus).
Press "Y" or "y" keys to toggle
the availability of anomaly bars. Intended to be used with Japanese Abacus
and base 20 for the Mesoamerican Abacus. (Mutually exclusive to watch
bars).
Press "W" or "w" keys to toggle
the availability of watch bars. Intended to represent seconds where hours
and minutes can be set. (Mutually exclusive to anomaly bars).
Press ">" or "." keys to
speed up the movement of beads. Press "<" or
"," keys to slow down the movement of beads.
Press "@" key to toggle the sound.
Press "Esc" key to hide program.
Press "Q", "q", or
"CTRL-C" keys to kill program.
The abacus may be resized. Beads will reshape depending on the
room they have. Demo Mode: In this mode, the abacus is controlled by
the program. When started with the demo option, a second window is presented
that should be placed directly below the abacus-window. Descriptive text,
and user prompts are displayed in this window. Pressing 'q' during the demo
will quit it. Clicking the left mouse-button with the pointer in the window
will restart the demo (beginning of current lesson).
- -geometry
{+|-}X{+|-}Y
- This option sets the initial position of the abacus window (resource name
"geometry").
- -display
host:dpy
- This option specifies the X server to contact.
- -[no]mono
- This option allows you to display the abacus window on a color screen as
if it were monochrome (resource name "mono").
- -[no]{reverse|rv}
- This option allows you to see the abacus window in reverse video (resource
name "reverseVideo").
- -{foreground|fg} color
- This option specifies the foreground of the abacus window (resource name
"foreground").
- -{background|bg} color
- This option specifies the background of the abacus window (resource name
"background").
- -{border|bd} color
- This option specifies the foreground of the bead border (resource name
"borderColor").
- -frame
color
- This option specifies the foreground of the frame (resource name
"frameColor").
- -primaryBeadColor
color
- This option specifies the foreground of the beads (resource name
"primaryBeadColor").
- -leftAuxBeadColor
color
- This option specifies the foreground of the beads for the left auxiliary
abacus in Lee's Abacus (resource name
"leftAuxBeadColor").
- -rightAuxBeadColor
color
- This option specifies the foreground of the beads for the right auxiliary
abacus in Lee's Abacus (resource name
"rightBeadColor").
- -secondaryBeadColor
color
- This option specifies the secondary color of the beads (resource name
"secondaryBeadColor").
- -highlightBeadColor
color
- This option specifies the highlight color of the beads (resource name
"highlightBeadColor").
- -primaryRailColor
color
- This option specifies the foreground of the rails (resource name
"primaryRailColor").
- -secondaryRailColor
color
- This option specifies the secondary color of the rails (resource name
"secondaryRailColor").
- -highlightRailColor
color
- This option specifies the highlight color of the rails (resource name
"highlightRailColor").
- -lineRailColor
color
- This option specifies the color of the lines when using checkers (resource
name "lineRailColor").
- -bumpSound
filename
- This option specifies the file for the bump sound for the movement of the
beads (resource name "bumpSound").
- -moveSound
filename
- This option specifies the file for the move sound for the sliding of the
decimal point marker (resource name "moveSound").
- -dripSound
filename
- This option specifies the file for the drip sound for changing the format
(resource name "dripSound").
- -[no]sound
- This option specifies if a sliding bead should make a sound or not
(resource name "sound").
- -delay
msecs
- This option specifies the number of milliseconds it takes to move a bead
or a group of beads one space (resource name
"delay").
- -[no]script
- This option specifies to log application to stdout, every time the
user clicks to move the beads (resource name "script").
The output is a set of auxiliary, deck, rail, beads added or subtracted,
and the number of text lines (4). This can be edited to add text to the
lesson and used as a new demo keeping the generated numbers and the number
of lines constant. (Windows version writes to abacus.xml.)
- -[no]demo
- This option specifies to run in demo mode. In this mode, the abacus is
controlled by the current lesson (resource name "demo").
When started with the demo option, a window contains descriptive text, and
user prompts are displayed in this window. Pressing 'q' during the demo
will quit it. Clicking the left mouse-button with the pointer in the
window will restart the demo (beginning of current lesson). The demo uses
abacusDemo.xml and currently there are 4 editions possible (Chinese,
Japanese (and Roman), Korean, and Russian (and Danish)).
- -demopath
path
- This option specifies the path for the demo, possibly something like
/usr/local/share/games/xabacus (resource name
"demoPath"), with the file name of abacusDemo.xml. For
this to work, the program must be compiled with XML2 or else will use a
brief static fallback demo.
- -demofont
fontstring
- This option specifies the font for the explanatory text that appears in
the secondary window, during the demo. The default font is 18 point
Times-Roman (-*-times-*-r-*-*-*-180-*). The alternate font is 8x13.
- -demofg
color
- This option specifies the foreground of the abacus demo window (resource
name "demoForeground").
- -demobg
color
- This option specifies the background of the abacus demo window (resource
name "demoBackground").
- -[no]teach
- This option specifies to run in teach mode. In this mode, the abacus is
controlled by 2 numbers separated by an operator: "+" for
addition, "-" for subtraction, "*" for multiplication,
and "/" for division. The square root operation is represented
by the number to be operated on followed by the character "v"
(this leaves you with an answer from which you must divide by 2).
Similarly, the cube root operation is represented by the number to be
operated on followed by the character "u" (this leaves you with
an answer from which you must divide by 3). Press return key to progress
through the steps (resource name "teach").
- -[no]rightToLeftAdd
- This option specifies the order for teach starting side for addition and
subtraction. The default is the traditional left to right. Right to left
seems easier though (resource name
"rightToLeftAdd").
- -[no]rightToLeftMult
- This option specifies the order for teach starting side for
multiplication. The default is the traditional left to right. Right to
left seems more straight forward (resource name
"rightToLeftMult").
- -[no]lee
- This option allows you to turn on and off the two extra auxiliary abaci
(resource name "lee").
- -rails
int
- This option specifies the number of rails (resource name
"rails").
- -leftAuxRails
int
- This option allows you to set the number of the rails for the left
auxiliary abacus in Lee's Abacus (resource name
"leftAuxRails").
- -rightAuxRails
int
- This option allows you to set the number of the rails for the right
auxiliary abacus in Lee's Abacus (resource name
"rightAuxRails").
- -[no]vertical
- This option allows you to set the abacus to allow a Russian orientation
(resource name "vertical").
- -colorScheme
int
- This option specifies the color scheme for the abacus (resource name
"colorScheme") where 0-> none, 1-> darken middle
bead (2 beads if even), 2-> darken first bead of a group, 4-> use
secondary color for second half of a row of beads (but if odd color middle
bead), 8-> use secondary color for second third of a row of beads,
16-> use secondary color in alternate groups. Use a mask of 31 for
combinations.
- -[no]slot
- This option allows you to have either slots or rails (resource name
"slot").
- -[no]diamond
- This option allows you to have either diamond or round beads (resource
name "diamond").
- -railIndex
int
- This option specifies the index of color for the rails of the abacus
(resource name "railIndex") where a value is 0 or 1.
- -[no]topOrient
- This option specifies the orientation of the beads on top (resource name
"topOrient").
- -[no]bottomOrient
- This option specifies the orientation of the beads on bottom (resource
name "bottomOrient").
- -topNumber
int
- This option specifies the number of beads on top (resource name
"topNumber").
- -bottomNumber
int
- This option specifies the number of beads on bottom (resource name
"bottomNumber").
- -topFactor
int
- This option specifies the multiply factor for the beads on top (resource
name "topFactor").
- -bottomFactor
int
- This option specifies the multiply factor for the beads on bottom
(resource name "bottomFactor").
- -topSpaces
int
- This option specifies the number of spaces on top (resource name
"topSpaces").
- -bottomSpaces
int
- This option specifies the number of spaces on bottom (resource name
"bottomSpaces").
- -topPiece
int
- This option specifies the number of pieces on top (resource name
"topPiece").
- -bottomPiece
int
- This option specifies the number of pieces on bottom (resource name
"bottomPiece").
- -topPiecePercent
int
- This option specifies the number of piece percents on top (resource name
"topPiecePercent").
- -bottomPiecePercent
int
- This option specifies the number of piece percents on bottom (resource
name "bottomPiecePercent").
- -shiftPercent
int
- This option specifies the shift of rails for piece percents and also may
influence the precision of the calculation (resource name
"shiftPercent").
- -subdeck
int
- This option specifies the special subdecks column (resource name
"subdeck").
- -subbead
int
- This option specifies the special subbeads (resource name
"subbead").
- -[no]sign
- This option allows you to set the abacus to allow negatives (resource name
"sign").
- -decimalPosition
int
- This option specifies the number of rails to the right of the decimal
point (normally 2) (resource name
"decimalPosition").
- -[no]group
- This option allows you to group the displayed digits for readability
(resource name "group").
- -groupSize
int
- This option specifies the group size to the left of the decimal point
(normally 3) (resource name "groupSize").
- -[no]placeOnRail
- This option allows you to place the decimal and group separators on rail
(or just after) (resource name "placeOnRail").
- -[no]decimalComma
- This option allows you to swap "." for "," to allow
for different display format (resource name
"decimalComma").
- -base
int
- This option specifies the base used on abacus (default is base 10)
(resource name "base").
- -[no]eighth
- This option specifies the base for the Roman subdeck, (if set, the
resource is set to 8, else it is set to 12) (resource name
"subbase").
- -anomaly
int
- This option specifies the offset from the base for a multiplicative factor
of the rail with the anomaly (if none, this is set to 0) (resource name
"anomaly").
- -shiftAnomaly
int
- This option specifies the offset from decimal point for the anomaly
(usually 2) (resource name "shiftAnomaly").
- -anomalySq
int
- This option specifies the offset from base for the second anomaly (if
none, this is set to 0) (resource name "anomalySq").
- -shiftAnomalySq
int
- This option specifies the offset in rails from the first anomaly (usually
2) (resource name "shiftAnomalySq"). doing).
- -displayBase
int
- This option specifies the base displayed (default is base 10) (resource
name "displayBase"). If this is different then
"base" then it is implemented using "long long"
and the calculation is limited by its bounds. Also the fractional part
does not scale with the "displayBase" so if the
"displayBase" is greater than the "base"
it looses some precision. Also no rounding is done.
- -[no]pressOffset
- This option allows you to put a pixel space between all the beads so there
is room for the bead to move when pressed (resource name
"pressOffset").
- -[no]romanNumerals
- This option allows you to set the abacus to allow Roman Numerals (resource
name "romanNumerals"). Roman Numerals above 3999 are
normally represented with bars on top, due to ASCII constraints this is
represented instead in lower case (historically case was ignored). Roman
Numerals above 3,999,999 were not represented historically. Roman numerals
change with displayBase in an "experimental" way. When used with
twelfths and subdecks, named fraction symbols are used. Due to ASCII
constraints the sigma is represented as E, the backwards C is represented
as a Q, the mu as a u, and the Z with a - through the center as a z. If
available, decimal input is ignored.
- -[no]latin
- This option allows you to set the abacus to allow latin fractions instead
of symbolic in the Roman numeral output (resource name
"latin").
- -[no]ancientRoman
- This option allows you to set the abacus to allow ancient Roman numerals
instead of the modern in the Roman numeral output (resource name
"ancientRoman").
- -[no]modernRoman
- This option allows you to set the abacus to allow modern Roman numerals
instead of the ancient on the Roman Hand abacus (resource name
"modernRoman").
- -chinese
- This option specifies the format on the abacus (resource name
"format") to "Chinese" for the Chinese
Suanpan.
- -japanese
- This option specifies the format on the abacus (resource name
"format") to "Japanese" for the Japanese
post-WWII Soroban. This is also similar to the Roman Hand Abacus.
- -korean
- This option specifies the format on the abacus (resource name
"format") to "Korean" for the Korean Jupan or
Japanese pre-WWII Soroban.
- -russian
- This option specifies the format on the abacus (resource name
"format") to "Russian" for the Russian Schoty.
To complete, specify piece" to be 4, for the older Schoty also
specify piecePercent" to be 4.
- -danish
- This option specifies the format of the abacus (resource name
"format") to "Danish" for the Danish Elementary
School Abacus teaching aid.
- -roman
- This option specifies the format on the abacus (resource name
"format") to "Roman" for the Roman Hand Abacus,
note beads move in slots. To complete, specify
romanNumerals".
- -medieval
- This option specifies the format of the abacus (resource name
"format") to "Medieval" for the Medieval
Counter, with counters instead of beads.
- -generic
- This option specifies the format on the abacus (resource name
"format") to "Generic". This option specifies a
format that is more configurable by using resources, since there are few
rules to govern its behavior.
- -it
- This option specifies the subformat of the abacus in Museum of the
Thermae, Rome.
- -uk
- This option specifies the subformat of the abacus in British Museum in
London.
- -fr
- This option specifies the subformat of the abacus in Cabinet de medailles,
Bibliotheque nationale, Paris.
- -version
- This option tells you what version of xabacus you have.
Luis Fernandes https://www.ee.ryerson.ca/~elf/abacus/
Lee Kai-chen, How to Learn Lee's Abacus, 1958, 58 pages.
Abacus Guide Book, 57 pages.
Georges Ifrah, The Universal History of Numbers, Wiley Press 2000,
pp 209-211, 288-294.
Review of the above:
http://www.ams.org/notices/200201/rev-dauben.pdf
David Eugene Smith, History of Mathematics Volume II, Dover
Publications, Inc 1958, pp 156-195.
X(1), xcubes(6), xtriangles(6), xhexagons(6), xmlink(6),
xbarrel(6), xpanex(6), xmball(6), xpyraminx(6), xoct(6), xrubik(6),
xskewb(6), xdino(6)
® Copyright 1994-2020, David A. Bagley
Luis Fernandes, <elf AT ee.ryerson.ca> wrote an
independent program (xabacus 1.00) with a demo mode and postscript file. I
tried, with his permission, to take the best features of both into one
program. Also, I had help with some of the abacus in the Java version by
Sarat Chandran, <saratcmahadevan AT yahoo.com> and some of
these ideas were ported back into this X version.
Send bugs (or their reports, or fixes) to the author:
David A. Bagley, <bagleyd AT
verizon.net>
The latest version is currently at:
https://www.sillycycle.com/abacus.html
http://www.ibiblio.org/pub/Linux/apps/math/