diff options
author | Karl Berry <karl@freefriends.org> | 2009-08-17 23:52:56 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2009-08-17 23:52:56 +0000 |
commit | 2a0a733df59b5c7d85d190c433cbe0d6fdadc89d (patch) | |
tree | b73fb3ed2b7fbcf0106e14b1e00af89038513158 /Master/texmf-dist/metapost/suanpan/abacus.mp | |
parent | 73a57d66da93b7244ac5b75526fd95a00005b050 (diff) |
new metapost package suanpan (11aug09)
git-svn-id: svn://tug.org/texlive/trunk@14741 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/metapost/suanpan/abacus.mp')
-rw-r--r-- | Master/texmf-dist/metapost/suanpan/abacus.mp | 138 |
1 files changed, 138 insertions, 0 deletions
diff --git a/Master/texmf-dist/metapost/suanpan/abacus.mp b/Master/texmf-dist/metapost/suanpan/abacus.mp new file mode 100644 index 00000000000..fbd23eed722 --- /dev/null +++ b/Master/texmf-dist/metapost/suanpan/abacus.mp @@ -0,0 +1,138 @@ +input suanpan + +setup_abacus(N=13,NBL=5,NBU=2,bead="suanpan",units=0); + +% initial value of a suanpan +beginfig(1); + rod_numbers:=false; + reset_abacus; + draw_abacus; +endfig; + + +setup_abacus(N=13,NBL=4,NBU=1,bead="soroban",units=1); + +% initial value of a soroban +beginfig(2); + rod_numbers:=false; + reset_abacus; + draw_abacus; +endfig; + +setup_abacus(N=13,NBL=5,NBU=2,bead="suanpan",units=0); +beginfig(3); + rod_numbers:=true; + reset_abacus; + valL[1]:=2; + valL[3]:=5; + valU[2]:=1; + valU[4]:=2; + draw_abacus; +endfig; + +beginfig(4); + reset_abacus; + set_abacus_val("10552"); + draw_abacus; +endfig; + +beginfig(10); + reset_abacus; + valL[1]:=2; + valL[3]:=5; + valU[2]:=1; + valU[4]:=2; + draw_abacus; +endfig; + +beginfig(20); + reset_abacus; + valL[1]:=3; + valL[3]:=5; + valU[2]:=1; + valU[4]:=2; + draw_abacus; +endfig; + +% soroban? +beginfig(30); + setup_abacus(N=13,NBL=4,NBU=1,bead="soroban",units=1); + set_abacus_val("651324"); + set_abacus_gray(deck="lower",below="000011", + above="000010"); + set_abacus_gray(deck="upper",below="000001", + above="000010"); + draw_abacus; + mark_abacus(i=1,j=5)(btex 1 etex); + mark_abacus(i=2,j=2)(btex 2 etex); + mark_abacus(i=2,j=3)(btex 3 etex); +endfig; + + +%show_val; + +setup_abacus(N=13,NBL=4,NBU=1,bead="soroban",units=1); +set_abacus_val("651324"); +reset_abacus_gray; +add_val(v="82363456",iv=100,fig=true); +%message "**********************************"; +%show_val; + +setup_abacus(N=13,NBL=5,NBU=2,bead="suanpan",units=0); + +% detailing one of the addition cases +beginfig(200); + reset_abacus; + reset_abacus_gray; + set_abacus_val("82951324"); + draw_abacus; +endfig; + +beginfig(201); + set_abacus_val("82951324"); + add_val(v="60000",iv=100,fig=false); + draw_abacus; +endfig; + +%------------------------------------------- + +beginfig(202); + reset_abacus; + reset_abacus_gray; + set_abacus_val("82951324"); + set_abacus_gray(deck="lower",below="1010000", + above="0400000"); + set_abacus_gray(deck="upper",below="0110000", + above="0000000"); + draw_abacus; +endfig; + +beginfig(203); + reset_abacus_gray; + add_val(v="60000",iv=100,fig=false); + set_abacus_gray(deck="lower",below="0400000", + above="1010000"); + set_abacus_gray(deck="upper",below="0000000", + above="0110000"); + draw_abacus; + mark_abacus(i=5,j=5)(btex 1 etex); +endfig; + +% the following two commands enable a base-8 abacus +vbu:=4; % value of a bead in the upper deck +setup_abacus(N=13,NBL=3,NBU=1,bead="suanpan",units=0); + +beginfig(300); + reset_abacus; + reset_abacus_gray; + set_abacus_val("3401256"); + draw_abacus; +endfig; + +beginfig(301); + add_val(v="1234",iv=100,fig=false); + draw_abacus; +endfig; + +end + |