Jump to content
Science Forums

Recommended Posts

Posted

A while back, with a mind toward exploring some speculation about time-traveling pool balls made in this post , I wrote a small program to simulate elastic collisions in 2 spatial. The bodies in it are “typed” that is, different program logic can apply to collisions between them, base on what they “are”. My intention was to have a “time travel hole” body that would displace “balls” that collided with it in time.

 

I’ve not yet gotten around to time travel-type bodies, but have 2 body types: “balls” (or, since they don’t have true angular momentum and they’re only in 2 dimensions, more like “pucks”) and “gutters” – linear objects that balls disappear when they contact.

 

This is enough to set up a “bowling alley” suitable for a competition. :)

 

Here’s the setup: the “alley” is a 9 by 9 square (corners at (1,1) and (9,9)) surrounded by gutters. 10 circular “pins”, each with diameter .5 and mass 1, are set at (5,5), (4,6), (6,6), (3,7), (5,7), (7,7), (2,8), (4,8), (6,8), (8,8). A ball with diameter 1 and mass 3 may be placed at any location (x,2), and given any velocity (h,v). It looks, therefore, something like this:

 1 2 3 4 5 6 7 8 9
1 . . . . . . . . .
2 . B             .
3 .               .
4 .               .
5 .       1       .
6 .     2   3     .
7 .   4   5   6   .
8 . 7   8   9   0 .
9 . . . . . . . . .

The object of the game is to remove all of the pins from play by causing them to collide with a gutter – since the surface is frictionless, all this requires in any but the most unusual situation is for each pin to be struck by the ball or another pin.

 

To play, post a value for x (between 1.5 and 8.5), h, and v. I’ll reply with the results.

 

For example, for x=1.5, (h,v)=(.87,1):

Left the 4 and 10 pins - not a win.

   c                               d

    f





                  1

              2       3

          4       5       6

      7       8       9       a

  e
Sim T:0

  c                               d







              f   1

             2        3

          4       5       6

      7       8       9       a

  e
Sim T:3.257532120793722407

  c                               d






                  1
               f

             2        3

          4       5       6

      7       8       9       a

  e
Sim T:3.518989094821347538

  c                               d






                     1


                 f    3

          4       5       6
             2
      7       8       9       a

  e
Sim T:4.662119398181308323

  c                               d





                      1



                  f   3

          4       5       6
            2
      7       8       9       a

  e
Sim T:5.08496613968448101

  c                               d





                       1



                   f  3

          4      5        6
           2
      7               9       a
               8
  e
Sim T:5.473444378169957758

  c                               d





                        1


                      3
                   f

          4      5        6
          2
      7               9       a

  e
Sim T:5.874075482978240739

  c                               d




                           1



                        3

                     f
          4               6

     7 2         5    9       a

  e
Sim T:7.00023810809474893

  c                               d



                              1



                          3



          4           f   6
    7
                      9       a
      2         5
  e
Sim T:8.035746865091581241

  c                               d



                               1



                          3



          4           f   6
    7
                     9        a
      2
  e
Sim T:8.322891012478744093

  c                               d



                                1



                           3



          4            f  6
   7
                     9        a
      2
  e
Sim T:8.677763957767684519

  c                               d



                                1



                           3


                          6
          4            f
   7
                     9        a

  e
Sim T:8.7871823262624635

  c                               d







                            3


                          6
          4            f
  7
                              a
                     9
  e
Sim T:9.35499389981379355

  c                               d







                             3


                           6
          4
                        f
                              a
                     9
  e
Sim T:9.73962210175333648

  c                               d






                               3



                            6
          4
                        f
                              a

  e
Sim T:10.65367876786687539

  c                               d









                             6

          4

                          f   a

  e
Sim T:12.32592343235649738

  c                               d











          4

                              a
                            f
  e
Sim T:16.15223318849125928

  c                               d











          4

                              a

  e
Sim T:16.26854475445460678

Here’re some technical details:

  • The simulation follows the classical laws of conservation of momentum and energy. In other words, it’s a purely Newtonian simulation of completely elastic collisions. (except for the “gutters”, which simply remove bodies, including their momentum and energy, from the system.
  • Although the simulation is “event based”, so as accurate as its arithmetic precision permits, it uses a built-in calculator with about 18 decimal digits precision, so has limited precision.
  • In the event that more than 2 bodies collide simultaneously, the simulation randomly chooses one body and alters its position slightly (eg: typically about 1e-16) so that only one collision occurs at a time. The way the pins are set up, you’ve got to try pretty hard to get this to happen.

Here’s the simulation’s MUMPS code:

n (XELCOL4,X,Y,R,M,VX,VY,T,CB,CT,B,C) x XELCOL4(-2),XELCOL4(-1) ;XELCOL4: elastic collison simulator w/multiple object types
x XELCOL4(0,0) w "Enter:(1)[Mass] (2){Radius|W,H} (3)X,Y (4)[VX,VY] (5)[type] (6)[time]",! f  R R,! q:R=""  x XELCOL4(0,1) ;XELCOL4(-2): read (default to circle)
s WTI=.25,WT=-WTI f  s WT=WT+WTI x XELCOL4(-1,1),XELCOL4(-1,2),XELCOL4(-1,3),XELCOL4(-1,5) s R=1 x XELCOL4(-1,6) q:R?1(1"Q",1"q").e  i R?1(1"D",1"d").e x XELCOL4(-1,4),XELCOL4(-1,5) s R=0 x XELCOL4(-1,6) q:R?1(1"Q",1"q").e ;XELCOL4(-1): interactive display
f  q:WT'>$o(C(""))!($d(C)<9)  X XELCOL4(1) ;XELCOL4(-1,1)
K W s B="" F  s B=$o(M() q:B=""  S X=WT-T(*VX(+X(,Y=WT-T(*VY(+Y(,$E(W(Y/.5+.51),X/.25+.51)=$E("123456789abcdef",:cup: ;XELCOL4(-1,2)
w ! f W=$o(W("")):1:$o(W(""),-1) W $e($g(W(W)),1,79),! ;XELCOL4(-1,3)
w !,"(1)[Mass] (2){Radius|W,H} (3)X,Y (4)[VX,VY] (5)[type] (6)[time]",! s B="" f  s B=$o(M(:))  q:B=""  w M(:)," ",R(;)," ",WT-T(:D*VX(B)+X(B),",",WT-T(B)*VY(B)+Y(B)," ",VX(B),$s(VX(B)!VY(B):",",1:""),VY(B)," ",B(B),! ;XELCOL4(-1,4)
W "Sim T:",WT," Sim step T:",WTI," Event:" w:$o(C(""))]"" C($o(C(""))),",",CB(C($o(C("")))) w " Event T:",$o(C("")),! ;XELCOL4(-1,5)
w:R "[D]etails, " w "[Q]uit, Sim step," w:$d(C)>9 " [N] for next event," r " or enter to continue:",R s:R>0 WTI=R s:$tr(R,"n","N")="N"&($d(C)>9) WT="."_$TR($J("",17-$L($P(WT,".")))," ",0)_1+$o(C(""))-WTI ;XELCOL4(-1,6)
n (XELCOL4,X,Y,R,M,VX,VY,T,CB,CT,B,C) k C,CB,CT s T=0,B1="" f  s (B1,B2)=$o(M(B1)) q:B1=""  x XELCOL4(4) ;XELCOL4(0): initialize
k C,CB,CT,T,R,M,X,Y,VX,VY,B s T=0 ;XELCOL4(0,0): clear bodies
n (XELCOL4,X,Y,R,M,VX,VY,T,CB,CT,B,C) s (B,B1)=$o(M(""),-1)+1,T(B)=+$p(R," ",6),M(B)=$p(R," "),R(B)=$p(R," ",2),X(B)=$p($p(R," ",3),","),Y(B)=$p($p(R," ",3),",",2),VX(B)=$p($p(R," ",4),","),VY(B)=$p($p(R," ",4),",",2),B(B)=$p(R," ",5) s:B(B)="" B(B)=1 x XELCOL4(4) ;XELCOL4(0,1): returns B add body given R:(1)[Mass] (2){Radius|W,H} (3)X,Y (4)[VX,VY] (5)[type] (6)[time]
k:$d(CT(R)) C(CT(R)),CT(R),CT(CB(R)),CB(CB(R)),CB(R) k M(R),R(R),X(R),Y(R),VX(R),VY(R),T(R) ;XELCOL4(0,2): remove body R
n (XELCOL4,X,Y,R,M,VX,VY,T,CB,CT,B,C,CR) i $d(C)>9  s T=$o(C("")) k IVX,IVY x XELCOL4(2),XELCOL4(3,5,B(B1),B(B2)) k C(T),CB(B1),CB(B2),CT(B1),CT(B2) m VX=IVX,VY=IVY s B2P=B2 s B1=B1 x XELCOL4(4),XELCOL4(5) s B1=B2P x XELCOL4(4),XELCOL4(5) ;XELCOL4(1): next event
s B1=C(T),TD=T-T(B1),X(B1)=VX(B1)*TD+X(B1),Y(B1)=VY(B1)*TD+Y(B1),T(B1)=T,B2=CB(B1),TD=T-T(B2),X(B2)=VX(B2)*TD+X(B2),Y(B2)=VY(B2)*TD+Y(B2),T(B2)=T ;XELCOL4(2): move affected body(s) to time T positions
s CX1=VY2*RYX+VX2*M(B2)*RM-(VY1*RYX+VX1*M(B1))*2/(M(B2)*RM*RM+M(B1)*(RYX*RYX+1)),CY1=CX1*RYX,CX2=-CX1*RM,CY2=CX2*RYX ;XELCOL4(3,0,1): elastic collision calculation
i YD s RYX=XD/YD,VX1=VY(B1),VY1=VX(B1),VX2=VY(B2),VY2=VX(B2) x XELCOL4(3,0,1) s IVX(B1)=$g(IVX(B1),VX(B1))+CY1,IVY(B1)=$g(IVY(B1),VY(B1))+CX1,IVX(B2)=$g(IVX(B2),VX(B2))+CY2,IVY(B2)=$g(IVY(B2),VY(B2))+CX2 ;XELCOL4(3,0,1,0)
i XD s RYX=YD/XD,VX1=VX(B1),VY1=VY(B1),VX2=VX(B2),VY2=VY(B2) x XELCOL4(3,0,1) s IVX(B1)=$g(IVX(B1),VX(B1))+CX1,IVY(B1)=$g(IVY(B1),VY(B1))+CY1,IVX(B2)=$g(IVX(B2),VX(B2))+CX2,IVY(B2)=$g(IVY(B2),VY(B2))+CY2 ;XELCOL4(3,0,1,1)
s RM=M(B1)/M(B2),XD=X(B2)-X(B1),YD=Y(B2)-Y(B1) x XELCOL4(3,0,1,$tr(XD,"-")>$tr(YD,"-")) ;XELCOL4(3,5,1,1): circle-circle col effect
s R=B1 x XELCOL4(0,2) ;XELCOL4(3,5,1,2): gutter-circle col effect
s R=B2 x XELCOL4(0,2) ;XELCOL4(3,5,2,1): circle-gutter col effect
k CR i $d(M(B1)) s B2="" f  s B2=$o(M(B2)) q:B2=""  i B2'=B1 s IT=-1 x XELCOL4(4,5,B(B1),B(B2)) i IT'<0 s CT=IT+T x XELCOL4(4,0,2) ;XELCOL4(4): calculate next collisions
s X1=T-T(B1)*VX(B1)+X(B1),Y1=T-T(B1)*VY(B1)+Y(B1),X2=T-T(B2)*VX(B2)+X(B2),Y2=T-T(B2)*VY(B2)+Y(B2) ;XELCOL4(4,0,1)
s F1=$s($d(CT(B1)):$s(CT(B1)>CT:1,CT(B1)<CT:0,1:""),1:1),F2=$s($d(CT(B2)):$s(CT(B2)>CT:1,CT(B2)<CT:0,1:""),1:1) i $s(F1&F2:1,F1_F2="":$r(2),1:0) s BK=B1,FK=F1 x:$d(CT(BK)) XELCOL4(4,0,2,0) s BK=B2,FK=F2 x:$d(CT(BK)) XELCOL4(4,0,2,0) s C(CT)=B1,(CT(B1),CT(B2))=CT,CB(B1)=B2,CB(B2)=B1 k CR(B1),CR(B2) ;XELCOL4(4,0,2)
s BK2=CB(BK),(CR(BK),CR(BK2))="" k C(CT(BK)),CT(BK2),CT(CB(BK2)),CB(BK2),CB(BK) s:FK="" T(BK2)="."_$TR($J("",17-$L($P(T(BK2),".")))," ",0)_1+T(BK2) ;XELCOL4(4,0,2,0)
x XELCOL4(4,0,1) s XD=X1-X2,YD=Y1-Y2,VXD=VX(B1)-VX(B2),VYD=VY(B1)-VY(B2),A=VXD**2+(VYD**2),B=XD*VXD+(YD*VYD)*2,C=XD**2+(YD**2)-(R(B1)+R(B2)**2),D=B*B-(4*A*C) i D'<0&A s IT=D**.5+B/A/-2 ;XELCOL4(4,5,1,1): circle-circle col detect
s I=B1,B1=B2,B2=I x XELCOL4(4,5,2,1) s I=B1,B1=B2,B2=I ;XELCOL4(4,5,1,2): circle-gutter col detect
s XD=$p(R(B1),","),YD=$p(R(B1),",",2),F=$s(XD&VX(B2):1,YD&VY(B2):2,YD&VX(B2):3,XD&VY(B2):4,1:0) x:F XELCOL4(4,0,1),XELCOL4(4,5,2,1,F) ;XELCOL4(4,5,2,1): gutter-circle col detect
s A=YD/XD,B=VY(B2)/VX(B2),C=A-B i C s IT=A*X1-(B*X2)+Y2-Y1/C-X2/VX(B2) ;XELCOL4(4,5,2,1,1)
s A=XD/YD,B=VX(B2)/VY(B2),C=A-B i C s IT=A*Y1-(B*Y2)+X2-X1/C-Y2/VY(B2) ;XELCOL4(4,5,2,1,2)
s IT=X1-X2/VX(B2) ;XELCOL4(4,5,2,1,3)
s IT=Y1-Y2/VY(B2) ;XELCOL4(4,5,2,1,4)
q  ;XELCOL4(4,5,2,2): gutters can't collide
s B1="" f  s B1=$o(CR(B1)) q:B1=""  x XELCOL4(4) ;XELCOL4(5)

Posted
position (4,2)

velocity (.25,1.5)

4 and 7 pins left - no win.

 

I think the program's ascii diagram looks better than the example I put in post 1. Scroll though the code window to watch the ascii movie. “1” – “a” are the pins, “f” the ball, “c”, “d”, “e” and (not visible) “b” the (poorly represented) gutters ;)

   c                               d

              f





                  1

              2       3

          4       5       6

      7       8       9       a

  e
Sim T:0

  c                               d






               f
                  1

              2       3

          4       5       6

      7       8       9       a

  e
Sim T:1.682493862571148118

  c                               d







               f
                    1
              2       3

          4       5       6

      7       8       9       a

  e
Sim T:2.22180586735190316

  c                               d







               f
                     1
             2        3

          4       5       6

      7       8       9       a

  e
Sim T:2.372214842067710483

  c                               d







                     1
               f

            2           3
          4       5       6

      7       8       9       a

  e
Sim T:2.80337786458540304

  c                               d







                       1

               f

          4       5   3
                              6
      7   2   8       9       a

  e
Sim T:3.665867116802858094

  c                               d







                       1

               f

          4       5
                      3        6
      7   2   8      9       a

  e
Sim T:3.785181457235309326

  c                               d







                        1

               f

          4       5
                      3          6
      7       8      9       a

  e
Sim T:4.300658001254723145

4

  c                               d







                        1


               f
          4       5
                      3
      7       8      9       a

  e
Sim T:4.319608390578288404

  c                               d






                        1



               f
          4       5
                      3
      7       8              a
                    9
  e
Sim T:4.542272389957696707

  c                               d






                         1



               f
          4       5
                      3
      7       8              a

  e
Sim T:5.080949236958210883

1

  c                               d






                          1




          4   f    5
                      3
      7      8
                             a
  e
Sim T:5.700236110016146481

  c                               d






                           1




          4   f     5
                      3
      7      8
                             a
  e
Sim T:6.215112636730411789

1

  c                               d





                            1





          4         5
              f        3
      7
                             a
  e
Sim T:6.948916934697659471

63

  c                               d





                            1





          4         5
              f         3
      7

  e
Sim T:7.253282629038822273

  c                               d











          4
                    5
      7                       3
              f
  e
Sim T:10.66667443600961184

  c                               d











          4
                   5
      7                         3

  e
Sim T:11.89386486374767834

  c                               d











          4
                   5
      7

  e
Sim T:12.72913929773333069

  c                               d











          4

      7

  e
Sim T:30.70859701686344013

Posted

:eek_big: Aw, c’mon – after 38 hours, only 1 play?

 

I was hoping to play the first game until someone won, then try a couple of variation – more difficult pin layouts, and a game where your inputs were subjected to random “inaccuracy” factors – but if nobody plays, none of that’s go’na happen!

 

Just to assuage any suspicions that the game’s not winnable, here’re the results of a program I ran that played the game for every x value from 1.605 to 5.755 in .01 steps, and every (h,v) from (0,1) to (.86, .510294032886922949) in steps .01 for h (keeping the ball’s speed a constant 1). Excluding plays that removed 0 pins: 7.5% removed 1 pin, 10.7% 2, 8.9% 3, 13.3% 4, 14.9% 5, 14.6% 6, 14.2% 7, 9.7% 8, 5.2% 9, and 0.9% all 10 pins.

 

If you’d like, you can change the mass of the ball from its given value of 3 times that of each pin. According to the data I gathered via the above program, the way to go with changing the ball mass is not, as you might intuitively expect, increasing it, but decreasing it to about 1.75. For a ball with mass 1.75, the results are: 9.9% removed 1 pin, 7.6% 2, 8.8% 3, 13.0% 4, 13.5% 5, 17.6% 6, 15.0% 7, 9.1% 8, 4.0% 9 and 1.7% all 10 pins.

Posted
Ok, x=1.5, (h,v)=(.86,1.3)
A nasty split results, leaving the 1, 3, 4, 6, 7 & 8 pins.
   c                               d

    f





                  1

              2       3

          4       5       6

      7       8       9       a

  e
Sim T:0 

  c                               d







            f     1

              2       3

          4       5       6

      7       8       9       a

  e
Sim T:2.550422007712599994 

                  1
              f
                      3

          4     2 5       6

      7       8       9       a

  e
Sim T:3.25

  c                               d







                  1
              f
                      3

          4       5       6
                 2
      7       8       9       a

  e
Sim T:3.5

  c                               d







                  1

               f      3

          4       5       6

      7       8       9       a
                  2
  e
Sim T:3.75

  c                               d







                  1

               f      3

          4       5       6

      7       8       9       a

  e
Sim T:3.975354576592328396 

  c                               d







                  1

                f     3

          4       5       6

      7       8       9       a

  e
Sim T:4.27278087469325183 

  c                               d







                  1

                      3
                 f
          4               6
                    5
      7       8       9       a

  e
Sim T:5.15180413387607972 

  c                               d







                  1

                      3
                   f
          4               6

      7       8          9    a

  e
Sim T:6.379778024715319505 

  c                               d







                  1

                      3

          4         f     6
                              a
      7       8             9

  e
Sim T:7.29626546289409707

  c                               d







                  1

                      3

          4               6
                      f         a
      7       8

  e
Sim T:8.843747701049772658 

  c                               d







                  1

                      3

          4               6
                        f
      7       8

  e
Sim T:9.77509489965423258

  c                               d







                  1

                      3

          4               6

      7       8

  e
Sim T:14.70981727999254226

I added a couple of non-event images showing the 2 pin’s path.

Guest chendoh
Posted
A nasty split results, leaving the 1, 3, 4, 6, 7 & 8 pins.
Owwwww!!!!!.......There goes my 300 game! :cup:

How 'bout, :shrug: x=5.5, (h,v)=(.20,1.0).

What would I need to play this on my Pc?:turtle:

Posted
Owwwww!!!!!.......There goes my 300 game! :shrug:

How 'bout, :turtle: x=5.5, (h,v)=(.20,1.0).

Left the 1, 2, 4, 5, 7 and 8 pins.
   c                               d

                    f





                  1

              2       3

          4       5       6

      7       8       9       a

  e
Sim T:0

  c                               d







                  1   f

              2      3

          4       5       6

      7       8       9       a

  e
Sim T:3.265805419256236132

  c                               d







                  1
                        f
              2

          4       5       6
                    3
      7       8       9       a

  e
Sim T:4.452220218139312724

  c                               d







                  1

              2         f

          4       5       6

      7       8   3    9      a

  e
Sim T:5.18515941346474536

  c                               d







                  1

              2
                         f
          4       5
                           6
      7       8               a
              3
  e
Sim T:6.136453831387942497

  c                               d







                  1

              2
                         f
          4       5
                           6
      7       8               a

  e
Sim T:6.194847311346391677

  c                               d







                  1

              2
                          f
          4       5

      7       8               a

  e
Sim T:7.532138137286044254

  c                               d







                  1

              2

          4       5         f

      7       8               a

  e
Sim T:9.55820894341865905

  c                               d







                  1

              2

          4       5
                            f
      7       8

  e
Sim T:12.34030496315989419

  c                               d







                  1

              2

          4       5

      7       8

  e
Sim T:21.04321358206738898

Posted
What would I need to play this on my Pc?:turtle:
A MUMPS language interpreter. A free, non-expiring, single user copy of the one I use can be had at Free Caché Downloads. The vendor, Intersystems, requires you register an email address with them to get it, but in my experience won’t spam you unless you request it, or give the address to any other company.

 

Pay no attention to the name “Cache”. Intersystems makes a great effort to hide the fact that Cache is, in fact, a (much extended) implementation of the MUMPS language, but it’s one of the best.

 

Once installed, you need only click on the icon it installs in your system tray, or follow the start menu path to its “Terminal” application, and paste the following into it

 f  r R q:'$l(R)  s I=$p($p(R,";",$l(R,";")),":") i $l(I) s @I=R

(making sure to end with exactly 1 Enter keystroke) followed by the code in post #1, followed by a blank line (the Enter key), followed by

x XELCOL4
1 .25 5,5
1 .25 4,6
1 .25 6,6
1 .25 3,7
1 .25 5,7
1 .25 7,7
1 .25 2,8
1 .25 4,8
1 .25 6,8
1 .25 8,8
8,0 1,1  2
0,8 1,1  2
0,8 9,1  2
8,0 1,9  2
3 .5 5.5,2 .2,1

, where the last line gives the mass, radius position and velocity of the ball. Pressing enter at the following prompts will step you through the simulation, and, if you want, give you more detailed data than I’ve been posting here.

 

In addition to letting you run the MUMPS code I post so much of at hypography, the free application has the full IDE and documentation for the language, and a lot of extensions beyond the language standard. You may find, as I do, that MUMPS and Cache are nifty language for prototyping, simulating, and other math and science-y fun. :shrug:

 

It goes without saying, let me know if I can be of any help.

Posted
OKay, how about:

Position(3.5,2)

velocity (.30,1)

The 3, 4, 6, 7, and 8 pins are left standing.
   c                               d

            f





                  1

              2       3

          4       5       6

      7       8       9       a

  e
Sim T:0

  c                               d






               f
                  1

              2       3

          4       5       6

      7       8       9       a

  e
Sim T:2.703563949598667274

  c                               d







               f    1

             2        3

          4       5       6

      7       8       9       a

  e
Sim T:3.408421161479837958

  c                               d









                f     3     1

          4       5       6

      7   2   8       9       a

  e
Sim T:5.466074591404037957

  c                               d









                      3       1
                f
          4        5      6

      7       8       9       a

  e
Sim T:6.160782275673209527

  c                               d









                      3
                f                1
          4               6
                    5
      7       8       9       a

  e
Sim T:6.792207410463846732

  c                               d









                      3
                f
          4               6

      7       8    5  9       a

  e
Sim T:7.031174073234487094

  c                               d









                      3

          4     f         6

      7       8           9   a

  e
Sim T:8.873646525264264782

  c                               d









                      3

          4               6
                f
      7       8             9 a

  e
Sim T:10.13497354372257228

  c                               d









                      3

          4               6
                              a
      7       8  f

  e
Sim T:12.27924349590418381

  c                               d









                      3

          4               6    a

      7       8

  e
Sim T:14.83516568196026307

  c                               d









                      3

          4               6

      7       8

  e
Sim T:21.50241199476467797

Guest chendoh
Posted

CraigD, or if I may call you CD, in the interest of brevitity.

 

I scanned your post last night 'bout 8:30pm est. an had to be in work at 9pm est.

I did see the download page for the 'terperter @ Free Cache', an will be doing the setup..........give me a couple' a days........SteveY

 

 

Ps....Is the 5.2.3mv ver. the one ya pay for?

Posted
... I did see the download page for the 'terperter @ Free Cache', an will be doing the setup..........give me a couple' a days........SteveY
Cool.
Ps....Is the 5.2.3mv ver. the one ya pay for?
I’m running an older version, 5.0.11. This is because the “client tools” – the “Studio” editor, etc. – for versions 5.0.x and 5.1+ are not compatible with one another’s servers, and I need to use them not only to talk to the free instance of Cache on my PC, but to remotely access ones at several sites where I work that are running 5.0.x.

 

Everything I post at hypography is pure, ANSI X11.1-1995 standard MUMPS, meaning it will run on practically every implementation of MUMPS written since the early 1990s, and most older versions – though a few of the more memory-hungry ones may have problems on some older versions.

Guest chendoh
Posted

I DL, and installed 5.2.0.329.1_su, this morning, glad I have DSL, even with that it took 40".

 

Followed your prompts from post #9, and had my first game of NB just using your code....experimentation awaits!:hyper:

 

A question, can the code be saved or does it have to be entered for each new game?:D

Posted
I DL, and installed 5.2.0.329.1_su, this morning, glad I have DSL, even with that it took 40".

 

Followed your prompts from post #9, and had my first game of NB just using your code....experimentation awaits!:hyper:

Congratulations! I believe you are the first hypographer other than me with ready access to a MUMPS interpreter :)

 

Now that you have a technological edge over the competition (OK, only Jay-qu and Janus so far – clearly the lack of huge cash prizes is making this a rather low-key competition ;)), you should pretty quickly be able to trail-and-error your way to a winning solution – though likely not before you begin cursing my crude interface for its lack of a “save/restore” function :evil:

A question, can the code be saved or does it have to be entered for each new game?:D
Yes, it can easily be saved.

 

XELCOL4 is, in MUMPS terms a “local symbol”, meaning it persists only as long as your job (terminal session). It’s easy to copy it to a persistent, on-disk “global”, by entering something like this (only needs to be done once, unless changes are made to XELCOL4):

m ^SAVENB=XELCOL4

Then, each time you start a new terminal session, you can copy it back to its local symbol with this:

m XELCOL4=^SAVENB

“M” is the abbreviation for the MUMPS command “merge” – you can enter the full keyword “merge” if you like, but most people prefer to use the abbreviations. Note that the only difference between a local and a global is that the latter begins with the special character “^”.

 

If you want a lot of convenience, you can create a small xecute code program to load and start the game, by entering something like

s ^playNB="m XELCOL4=^SAVENB x XELCOL4"

Then, to load and start the game, you need only enter (note that MUMPS local and global references are case sensitive, so “^playNB” is not the same as “^PlayNB” or “^playnb”):

x ^playNB

 

The global reference you use to store things is MUMPS is up to you – as long as you don’t use one being used for something else, it’s OK. You can tell if a global (such as “^MYGLOBAL”) exists by entering:

w $d(^MYGLOBAL)

If “0” is displayed, it doesn’t. You can use a single global name to store all things of a certain kind, such as xecute code from hypgraphy, by varying the above code slightly to something like

m ^HYPOX("XELCOL4")=XELCOL4

and

m XELCOL4=^HYPOX("XELCOL4")

I personally use a pretty jazzy little collection of utilities to keep a “library” of useful xecute code programs, which has automatic versioning, and basic shared subroutine loading features. It’s anybody’s for the asking, but I think it might be more than you need unless you begin seriously writing and/or managing xecute code programs.

Posted

Here’s another egregious bump for my poor, unpopular competition thread: :(

 

Almost anybody who knows classical mechanics (ie: conservation of momentum and energy) at some point comments that the behavior of frictionless, perfectly elastic collection of bodies is completely deterministic, and can be calculated without much difficulty using paper and pencil. Here’s your chance to prove it!

 

A hint: if the completely deterministic paper and pencil (or computer equivalent) approach seems like too much work, try just submitting a guess where the ball at least hits the 1 and 2 pins, take note of which pins don’t get hit, and which pins (or the ball) come close to hitting them, and adjust your initial guess slightly so that they are hit. Varying any single one of the 3 inputs – x, h, or v – will in most cases eventually yield a win.

 

Detailed position and velocity data is available for any time in the simulation – Just let me know if you’d like something more than the rought ASCII “movies” I’ve been providing.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...