NAME

     xabacus - Abacus X widget


SYNOPSIS

     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}] [-rail {color}] [-bead
     {color}]  [-rails  {int}]  [-[no]slot]   [-[no]diamond]   [-
     [no]vertical]  [-{chinese|japanese|korean|roman|russian}] [-
     base {int}]  [-displayBase  {int}]  [-[no]romanNumerals]  [-
     [no]sign]  [-[no]quarter]  [-tnumber {int}] [-bnumber {int}]
     [-tfactor {int}] [-bfactor {int}] [-tspaces {int}] [-bspaces
     {int}]   [-[no]torient]  [-[no]borient]  [-delay  msecs]  [-
     [no]sound] [-bumpSound {filename}]  [-moveSound  {filename}]
     [-[no]demo]   [-[no]script]  [-demopath  {path}]  [-demofont
     {fontname}] [-demofg {color}] [-demobg {color}] [-version]


DESCRIPTION

     This is an implementation  of  the  classic  Chinese  abacus
     (Saun-pan) which has its origins in the 12th century.

     The device has two decks.  Each deck, separated by a  parti-
     tion,  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 subtrac-
     tion.  Multiplication can be done by mentally doing the mul-
     tiplications  while  adding  up  the  intermediate  results.
     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, here it is nice to have a long abacus.

     The pre-WWII Japanese abacus (Soroban) (or Korean Supan)  is
     similar to the Chinese abacus but has only one bead per rail
     on the top deck.  The later Japanese abacus was further sim-
     plified 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  combi-
     nation  of  halves, quarters, and thirds of an ounce and had
     no slot 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, 1 for quar-
     ters,  and  the  bottom 2 for thirds).  In another surviving
     example: the 2 special columns were switched and the  combi-
     nation column was broken into 3 separate slots.

     The Russian abacus was invented in the  17th  century,  here
     the  beads  are  moved  from  right  to  left (currently the
     xabacus can not be oriented that way and one has to move the
     beads down).  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 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.


FEATURES

     Click "mouse-left" button on a bead you want to  move.   The
     beads  will  shift  themselves  to vacate the row and column
     that was clicked.

     Click "mouse-right" button, or press "C"  or  "c"  keys,  to
     clear the abacus.

     Press "O" or "o" keys to toggle the demo mode.

     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, Roman, and Russian formats.

     Press "V" or "v" keys to toggle  vertical  Russian  orienta-
     tion.

     Press "M" or "m" keys to toggle Roman Numerals.

     Press "S" or "s" keys to toggle  the  availability  of  sign
     bead.

     Press "U" or "u" keys to toggle the availability of  quarter
     beads.

     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).


OPTIONS

     -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 on a color screen
             as if monochrome (resource name "mono").

     -[no]{reverse|rv}
             This option allows you to see the abacus  window  in
             reverse video (resource name "reverse").

     -{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  border
             of the beads (resource name "borderColor").

     -frame color
             This option specifies the foreground  of  the  frame
             (resource name "frameColor").

     -rail color
             This option specifies the foreground  of  the  rails
             (resource name "railColor").

     -bead color
             This option specifies the foreground  of  the  beads
             (resource name "beadColor").

     -rails int
             This option specifies the number of rails  (resource
             name "rails").

     -[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").

     -chinese
             This option  specifies  the  format  on  the  abacus
             (resource   name  "format")  to  "Chinese"  for  the
             Chinese Saun-pan.

     -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
             Supan or Japanese pre-WWII Soroban.

     -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".

     -russian
             This option  specifies  the  format  on  the  abacus
             (resource  name  "format") to "Russian" for the Rus-
             sian Schoty.  To complete, specify quarter".

     -other  This option  specifies  the  format  on  the  abacus
             (resource  name  "format")  to "Other".  This option
             specifies a format  that  is  more  configurable  by
             using resources, since there are few rules to govern
             its behavior.

     -base int
             This  option  specifies  the  base  used  on  abacus
             (default  is  base  10)  (resource name "base").  By
             default, one has to set the format mode  to  not  be
             Other for this to work (unless you know what you are
             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]vertical
             This option allows you to set the abacus to allow  a
             Russian orientation (resource name "vertical").

     -[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.

     -[no]sign
             This option allows you to set the  abacus  to  allow
             negatives (resource name "sign").

     -[no]quarter
             This option allows you to set the  abacus  to  allow
             quarters (resource name "quarter").

     -tnumber int
             This option specifies the number  of  beads  on  top
             (resource name "topNumber").

     -bnumber int
             This option specifies the number of beads on  bottom
             (resource name "bottomNumber").

     -tfactor int
             This option specifies the multiply  factor  for  the
             beads on top (resource name "topFactor").

     -bfactor int
             This option specifies the multiply  factor  for  the
             beads on bottom (resource name "bottomFactor").

     -tspaces int
             This option specifies the number of  spaces  on  top
             (resource name "topSpaces").

     -bspaces int
             This option specifies the number of spaces on bottom
             (resource name "bottomSpaces").

     -[no]torient
             This option specifies the orientation of  the  beads
             on top (resource name "topOrient").

     -[no]borient
             This option specifies the orientation of  the  beads
             on bottom (resource name "bottomOrient").

     -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]sound
             This option specifies if a sliding bead should  make
             a sound or not (resource name "sound").

     -bumpSound filename
             This option specifies the file for  the  bump  sound
             (resource name "bumpSound").

     -moveSound filename
             This option specifies the file for  the  move  sound
             (resource name "moveSound").

     -[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 Abacus1.les for the first  Chinese  Abacus
             lesson,  Abacusjp1.les  for  the first Japanese (and
             Roman) Abacus lesson, Abacusko1.les for  the  Korean
             Abacus, and Abacusru1.les for the Russian Abacus.

     -[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
             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  con-
             stant.  If you want to add a "do nothing", the first
             line generated is an example of that.  For  example:
             "xabacus -script > Abacus5.les"

     -demopath path
             This option specifies the path for the demo,  possi-
             bly    something    like    /usr/share/games/xabacus
             (resource name "demoPath").  It initially looks  for
             Abacus1.les.   If  it finds that, it will later look
             for Abacus2.les, etc.

     -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").

     -version
             This option tells you what version  of  xabacus  you
             have.


REFERENCES

     Luis Fernandes  http://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.0


SEE ALSO

     X(1), xrubik(6), xskewb(6), xdino(6), xpyraminx(6), xoct(6),
     xmball(6),  xmlink(6),  xpanex(6), xcubes(6), xtriangles(6),
     xhexagons(6)


COPYRIGHTS

     (Reg.) Copyright 1994-2005, David Albert Bagley

     Luis Fernandes,  <elf@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,
     <aratcmahadevan@yahoo.com>  and  some  of  these  ideas were
     ported back into this X version.


BUG REPORTS AND PROGRAM UPDATES

     Send bugs (or their reports, or fixes) to the author:
          David Albert Bagley, <bagleyd@tux.org>

     The latest version is currently at:
          ftp://ftp.tux.org/pub/tux/bagleyd/xabacus
          ftp://ibiblio.org/pub/Linux/apps/math