Reference

xabacus(6x)

abacus calculator for X

NAME

xabacus - abacus calculator for X

SYNOPSIS

xabacus [-display displayname ] [ -demo pathtoscriptfiles -demofont | -fn Xfontstring ] [ -script ] [ -beadwidth width -beadheight height -framewidth width -framecolor colorname -bg colorname -beadcolor colorname -railcolor colorname ]

DESCRIPTION

This is an implementation of the classic Chinese abacus.

The device has two decks. Each deck, separated by a beam, normally has 13 rods on which are mounted beads. Each rod on the top deck contains 2 beads, and each rod on the bottom deck contains 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 beam separating the decks.

The device has two decks ("new & improved" models have auxilliary decks stacked above the principal decks that enable multiplication, division and square-root (honest!) computations to be performed with equal ease as addition and subtraction).

OPTIONS

-demo path to script files

Use this option to interactively learn to use the abacus. Lesson 1 teaches counting, lesson 2 teachs addition & lesson 3 teachs subtraction. The application will ignore command-line options regarding size (beadwidth, beadheight, framewidth); all other options are acknowledged.

The script for lesson-1 is called Lesson1.cmd, lesson-2 is contained in Lesson2.cmd and so on.

The script-files should be installed in /usr/lib/X11/xabacus.

For example:

	xabacus -demo ./

will instruct xabacus to look for the script-files in the current directory.

Similarily, the XAbacus.demo resource may also be used to specify the demo-path:

	XAbacus.demo: ./

Using this method, the -demo option need not be specified on the command-line.

If the script-files have been installed, then run the demo as:

	xabacus -demo /usr/lib/X11/xabacus

Refer to the section titled: OPERATION, for details about the demo-mode.

-demofont | -fn Xfontstring

Specify an alternate 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.

-script

Using this option, the application will log (to stdout ) a set of row/column coordinates according to the beads the user clicks.

This data may be logged to a file as follows:

	xabacus -script >script.log

The script may then be edited and then used to generate new demos.

-beadwidth width

The width of a bead, in pixels. The default is 30. For the sake of authenticity, the bead-width should be about 2/3 greater than the bead-height. If the bead-width is equal to the bead-height then the beads will (vaguely, even then, one has to squint) resemble circles (the screen's aspect ratio is not accounted for).

-beadheight height

The height of a bead, in pixels. The default is 20.

-framewidth width

In pixels, the width of the frame around, and separating the two decks. The default is 10.

-ncols columns

An integer representing the number of columns the abacus is to have, up to a maximum of 100. The default is 13.

-framecolor colorname

A valid color-name for the frame of the abacus. Default is "brown".

-bg colorname

A valid color-name for the background. Default is "white". Specifying a color other than the default will result in the beads having an unpredictable color. (This happens because the bead-image is XOR'd with the background when animating it.)

-bead-color colorname

A valid color-name for the color of the beads. Default is "green4".

-railcolor colorname

A valid color-name for the color of the rails. Default is "green4".

-help

Prints a summary of the command-line options.

OPERATION

Normal Operation: The beads may be moved by clicking on them with the mouse-pointer; the beads will shift themselves to vacate the row and column that was clicked. The abacus will beep when the mouse is clicked on an invalid location (like the middle-frame).

The abacus may be resized to accomodate more (or less, but no less than the minimum as specified with -ncols) columns; it resizes in width only. Columns are added only if the amount resized can accomodate a complete column. A maximum of 100 columns is possible, i.e. operations with numbers with up to 100 digits is possible.

Pressing 'q', 'Q' or '^C' will quit.

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 with lesson-1).

RESOURCES

The application class name is XAbacus.
Every command-line option has its equivalent X-resource as follows:
XAbacus
	.beadwidth
	.beadheight
	.framewidth
	.ncols
	.framecolor
	.bg
	.beadcolor
	.railcolor
	.demo
	.demofont

SEE ALSO

The Abacus: The Art of Calculation Using Beads, details all the known techniques for performing additions & subtractions.

xcalc(1), xfontsel(1), xrdb(1), X(1)

SCRIPT-FILE FORMAT

The format of the lesson script-file (Lessonn.cmd) is as follows:
<number of moves in the script>
<row> <col> <number-of-text-lines-that-follow>
text-line1
    :
    :
text-line4
<row> <col> <number-of-text-lines>
text-line1
    :
    :
text-line4
	:
	:

The text is displayed in the secondary window that appears during the demo. <number-of-text-lines-that-follow> cannot exceed 4 text-lines. Each row/col/text batch represents 1 "move". A row beginning with a negative number signifies that the move be ignored & that just the descriptove text be displayed. This is useful for explanatory pauses in the lesson. Refer to any of Lesson1.cmd, Lesson2.cmd or Lesson3.cmd.

FEATURES

A cosmetic bug occurs, when certain user-defined frame-widths are specified and a top-deck bead is moved down.

Columns are added only if the amount resized can accomodate a complete column.

When the application is resized, an incremental amount that does not accomodate a full column, it loses track of the correct number of columns.

ACKNOWLEDGEMENTS

Agustine Lee, instructor at the Ryerson Electrical Engineering Department provided a real, live abacus in addition to invaluable documentation on its use and comments on improving it.

Nick Colonello, for alpha-testing the application and providing constructive criticism.

Eva Dudova, for beta-testing the application.

And to those, before me, who have written X-applications, from whose code I have learned the art of X.

COPYRIGHT

Copyright 1991, Luis Fernandes.

Permission to use, copy, hack, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation.

This software is presented as is without any implied or written warranty.

AUTHOR

Luis Fernandes ([email protected])