History of Sticks! Script
Webb - all rights reserved - ©2004
spacer


modified by Russ Webb on  2004-04-22 20:50:09

Author - David Winslow
Email: dwinslow@databeam.com
Webpage:

Summary: Take the last stick and win fame and glory - CODE is FIXED
-There is a  bug in RPN Archive

Instructions: NOTE: Because of a BUG in RPN Archive you
will have to "edit" the code very slightly

Change:
[e] D'Enter .aabbcc[ddeeff] [+/-]\where 2 aa,bb...ff 100\e.g. -.070815
or .030507'd1 ;
To:
[e] D'Enter .aabbcc[ddeeff] [+/-]\where 2< aa,bb...ff<100\e.g. -.070815
or .030507'd1 ;

The only change is to add back in the two "<"

          |          |
symbols: 2^aa,bb...ff^100 -
          |          |
          put "less than symbols" in
          these spots ...
         
I've written Russ about the "less than"
"greater than" RPN Archive bug and he is
looking into it.



A long long time ago I read about this game
in an article by Martin Gardner in his wonderful
column (now, sadly, no longer) "Mathematical
Games and Recreations" in Scientific American.

The game is played with from 3 to 6 piles of
sticks. Each pile has from 3 to 99 sticks. You
may specify who moves first. If it is your move,
you pick a pile and remove as many sticks as you
want to from that pile (you can even remove ALL
the sticks from the pile). Then, RPN will do the
same thing ... Whoever takes the last stick WINS.

Here's what you see and how to enter games
and moves.

-------   Suppose you want 3 piles with 3, 5
| Setup |  and 7 sticks and you want to play
|       |  first. Enter .030507 and tap "Setup".
| Play  |  If you want RPN to move first then
-------   enter .030507 +/- and tap "Setup".


NOTE: Enter .aabbcc[ddeeff] [+|-] where
      2 < aa,bb,cc < 100 and
      bracketed material is optional. Then
      tap "Setup" to enter the game definition
      number.

      Include bracketed material to increase
      the number of piles and to specify
      who moves first.

To make a move, tap the number of piles, the
decimal point, and two digits for the number
of sticks: example 3.02 means remove 2 sticks
from pile 3. Then tap "Play".

NOTE: Enter p.nn and tap "Play" to make a move.
      p indicates the pile number and nn is
      the number of sticks. For pile three and
      two sticks enter 3.02 and NOT 3.2 (pile
      3 and 20 sticks)

Sample game: 3-5-7 you move first.

Taps                   What happens

                   ---- -------

.030507 Setup          Dialog: You go first
                       Stack:  0.030507 = tos

3.03 Play              1.02 appears briefly
                       to show RPN's move

                       Stack: 0.010504 = tos
                              0.030504
                              0.030507

2.02 Play              3.02 appears briefly
                       to show RPN's move

                       Stack: 0.010302 = tos
                              0.010304
                              0.010504
                              0.030504
                              0.030507

2.03 Play              3.01 appears briefly
                       to show RPN's move

                       Stack: 0.010001 = tos
                              0.010002
                              0.010302
                              0.010304
                              0.010504
                              0.030504
                              0.030507

1.01 Play              3.01 appears briefly
                       to show RPN's move

                       Dialog: I win

                       Stack: 0.000000 = tos
                              0.000001
                              0.010001
                              0.010002
                              0.010302
                              0.010304
                              0.010504
                              0.030504
                              0.030507

hmmmmmm .... RPN wins

OK, good luck!

TIPS:

First try the "traditional" game of 3-5-7
and choose to go first=> .030507 Setup

If you cannot win, then try letting
RPN go first=> .030507 +/- Setup

Note the exceptional way that RPN plays !!

After you think you have it, try 3-5-7 with
you moving first. Once you have mastered
3-5-7 you can increase the piles and the number
of sticks in each pile.

Another game to try is -.070815 (it is possible
to win this game). You could also try today's
date for a game: .07111999 - but, better not
let RPN go first on this game or you will have
a tough time winning.

The best settings for RPN are:

   Set "Places (X)" to 2 * (the number of piles)
   and do not "Strip zeros"

Want to know the secret? Want to know the
general strategy behind this game?

Drop me a line and I will be glad to send
you the algorithm and commented code. You can
make money at bars if you know this game well.

Code:

RPN.2.z-3 \Sticks
[a] xmXzxmV0{_xzv1+x@+v1+V};
[b]Xy6V0{xyvCu1->(vCp+xyvCu-Xy)_v};
[c]hV{_vd1};
[d] D'Enter p.nn where\p is the pile number\and nn is the number of
sticks.' ;
[e] D'Enter .aabbcc[ddeeff] [+/-]\where 2< aa,bb...ff< 100\e.g. -.070815
or .030507'd1 ;
[i]Vvbwxm>(Cdd1.)vwXzxz0=0(Cdd1.)xzx@vf2Cp*-g10<(d1Cdd1.)g1xzx@=0(d1Cdd1.)xzX@;

[j]V0Xm{v2Cp*g1wxm1+XmxmX@xmx@2>(:Ced1.)fVv0=0(B)};
[n]xmV0{_vv1+x@v1+2*Cp/+};
[p] #'10'r2P;
[r]CsCaCt;
[s]xmXzxm1+V{_xzvxm-x@CbvX@v1+V};
[t]TtXvV#'14'Xy{v0=0(B)v1Cp/g1wVf1Cp*xyX@xy1+Xy}xy#'14'-Xu#'13'xu+V{vx@2/f0>(B)v1-

Vv#'13'=0(B)}v#'13'-Xuxu0=0(xmV{_vv1+x@0>(v1+#'.01'+CzB)}:xm1+V{vx@xuCp/f1Cp*w1=

0(B)v1+V}vxm-XzxuV0{_vv#'14'+x@2/f0>(xzxm+x@v1+Cp/f1Cp*w1=0(vCu-:vCu+))}b2Cp/xz+Cz);

[u] 2r2P;
[z]Ud{1CpV{1_v}1CpV{d1_v}Ttxv-#'150'>(B)};
"Sticks"
"Setup"
h0=0(Ce.)VCcvwb0>(Ce.)v0>(1:2)XhvbfCjxm3<(Ce.:xm6>(Ce.) )Cnxh2=0
(D'I go flrst.|Ok|'d1CrCiCn:D'You go first.|p.nn and then Play|'d1);
~
"Play"
CiCng10=0(D'You win'd1.)CrCiCng10=0(D'I win'd1.);



modified by Russ Webb on  2004-04-22 20:53:47

Author - David Winslow
Email: dwinslow@databeam.com
Webpage:

Summary: Take the last stick and win fame and glory - CODE is FIXED
-There is a  bug in RPN Archive

Instructions: NOTE: Because of a BUG in RPN Archive you
will have to "edit" the code very slightly

Change:
[e] D'Enter .aabbcc[ddeeff] [+/-]\where 2 aa,bb...ff 100\e.g. -.070815
or .030507'd1 ;
To:
[e] D'Enter .aabbcc[ddeeff] [+/-]\where 2< aa,bb...ff<100\e.g. -.070815
or .030507'd1 ;

The only change is to add back in the two "<"

          |          |
symbols: 2^aa,bb...ff^100 -
          |          |
          put "less than symbols" in
          these spots ...

I've written Russ about the "less than"
"greater than" RPN Archive bug and he is
looking into it.



A long long time ago I read about this game
in an article by Martin Gardner in his wonderful
column (now, sadly, no longer) "Mathematical
Games and Recreations" in Scientific American.

The game is played with from 3 to 6 piles of
sticks. Each pile has from 3 to 99 sticks. You
may specify who moves first. If it is your move,
you pick a pile and remove as many sticks as you
want to from that pile (you can even remove ALL
the sticks from the pile). Then, RPN will do the
same thing ... Whoever takes the last stick WINS.

Here's what you see and how to enter games
and moves.

-------   Suppose you want 3 piles with 3, 5
| Setup |  and 7 sticks and you want to play
|       |  first. Enter .030507 and tap "Setup".
| Play  |  If you want RPN to move first then
-------   enter .030507 +/- and tap "Setup".


NOTE: Enter .aabbcc[ddeeff] [+|-] where
      2 < aa,bb,cc < 100 and
      bracketed material is optional. Then
      tap "Setup" to enter the game definition
      number.

      Include bracketed material to increase
      the number of piles and to specify
      who moves first.

To make a move, tap the number of piles, the
decimal point, and two digits for the number
of sticks: example 3.02 means remove 2 sticks
from pile 3. Then tap "Play".

NOTE: Enter p.nn and tap "Play" to make a move.
      p indicates the pile number and nn is
      the number of sticks. For pile three and
      two sticks enter 3.02 and NOT 3.2 (pile
      3 and 20 sticks)

Sample game: 3-5-7 you move first.

Taps                   What happens

                   ---- -------

.030507 Setup          Dialog: You go first
                       Stack:  0.030507 = tos

3.03 Play              1.02 appears briefly
                       to show RPN's move

                       Stack: 0.010504 = tos
                              0.030504
                              0.030507

2.02 Play              3.02 appears briefly
                       to show RPN's move

                       Stack: 0.010302 = tos
                              0.010304
                              0.010504
                              0.030504
                              0.030507

2.03 Play              3.01 appears briefly
                       to show RPN's move

                       Stack: 0.010001 = tos
                              0.010002
                              0.010302
                              0.010304
                              0.010504
                              0.030504
                              0.030507

1.01 Play              3.01 appears briefly
                       to show RPN's move

                       Dialog: I win

                       Stack: 0.000000 = tos
                              0.000001
                              0.010001
                              0.010002
                              0.010302
                              0.010304
                              0.010504
                              0.030504
                              0.030507

hmmmmmm .... RPN wins

OK, good luck!

TIPS:

First try the "traditional" game of 3-5-7
and choose to go first=> .030507 Setup

If you cannot win, then try letting
RPN go first=> .030507 +/- Setup

Note the exceptional way that RPN plays !!

After you think you have it, try 3-5-7 with
you moving first. Once you have mastered
3-5-7 you can increase the piles and the number
of sticks in each pile.

Another game to try is -.070815 (it is possible
to win this game). You could also try today's
date for a game: .07111999 - but, better not
let RPN go first on this game or you will have
a tough time winning.

The best settings for RPN are:

   Set "Places (X)" to 2 * (the number of piles)
   and do not "Strip zeros"

Want to know the secret? Want to know the
general strategy behind this game?

Drop me a line and I will be glad to send
you the algorithm and commented code. You can
make money at bars if you know this game well.

Code:

RPN.2.z-3 \Sticks
[a] xmXzxmV0{_xzv1+x@+v1+V};
[b]Xy6V0{xyvCu1->(vCp+xyvCu-Xy)_v};
[c]hV{_vd1};
[d] D'Enter p.nn where\p is the pile number\and nn is the number of
sticks.' ;
[e] D'Enter .aabbcc[ddeeff] [+/-]\where 2< aa,bb...ff< 100\e.g. -.070815
or .030507'd1 ;
[i]Vvbwxm>(Cdd1.)vwXzxz0=0(Cdd1.)xzx@vf2Cp*-g10<(d1Cdd1.)g1xzx@=0(d1Cdd1.)xzX@;

[j]V0Xm{v2Cp*g1wxm1+XmxmX@xmx@2>(:Ced1.)fVv0=0(B)};
[n]xmV0{_vv1+x@v1+2*Cp/+};
[p] #'10'r2P;
[r]CsCaCt;
[s]xmXzxm1+V{_xzvxm-x@CbvX@v1+V};
[t]TtXvV#'14'Xy{v0=0(B)v1Cp/g1wVf1Cp*xyX@xy1+Xy}xy#'14'-Xu#'13'xu+V{vx@2/f0>(B)v1-

Vv#'13'=0(B)}v#'13'-Xuxu0=0(xmV{_vv1+x@0>(v1+#'.01'+CzB)}:xm1+V{vx@xuCp/f1Cp*w1=

0(B)v1+V}vxm-XzxuV0{_vv#'14'+x@2/f0>(xzxm+x@v1+Cp/f1Cp*w1=0(vCu-:vCu+))}b2Cp/xz+Cz);

[u] 2r2P;
[z]Ud{1CpV{1_v}1CpV{d1_v}Ttxv-#'150'>(B)};
"Sticks"
"Setup"
h0=0(Ce.)VCcvwb0>(Ce.)v0>(1:2)XhvbfCjxm3<(Ce.:xm6>(Ce.) )Cnxh2=0
(D'I go flrst.|Ok|'d1CrCiCn:D'You go first.|p.nn and then Play|'d1);
~
"Play"
CiCng10=0(D'You win'd1.)CrCiCng10=0(D'I win'd1.);