Post Reply 
[VA] SRC #012a - Then and Now: Probability
10-18-2022, 12:25 PM
Post: #71
RE: [VA] SRC #012a - Then and Now: Probability
(10-18-2022 08:00 AM)J-F Garnier Wrote:  
(10-17-2022 06:29 PM)Dave Britten Wrote:  The results are in: it took around 4 hours to run the 30, 60 scenario on the pure-BASIC 1403H program.
What is the numeric result? I'm curious to compare the accuracy too, is the 1403H a 12-digit machine and does it manage the "round-to -even" rule? I gave a simple test to check it above.

I get 9.512343561E-06 for the 30, 60 bottom-row case, and the full probability map sums up to 1.000 000 009. I believe most Sharps are 10-digit machines.

Here's an amended version of the program that uses two of the ROM routines for matrix handling. Now it only takes a little over 3 hours to run the full 30, 60. :)

10 CLEAR:INPUT "ROWS?";M:INPUT "STEPS?";N:DIM Y(M,M):DIM X(M,M)
15 Y(1,1)=1:W=M-1:FOR I=1 TO N:X=0:CALL 26153
20 P=Y(1,1)/2:IF P LET X(2,1)=X(2,1)+P:X(2,2)=X(2,2)+P
25 P=Y(M,1)/2:IF P LET X(W,1)=X(W,1)+P:X(M,2)=X(M,2)+P
30 P=Y(M,M)/2:IF P LET X(W,W)=X(W,W)+P:X(M,W)=X(M,W)+P
35 FOR X=2 TO W:U=X-1:V=X+1:P=Y(X,1)/4:Q=Y(X,X)/4:R=Y(M,X)/4
40 IF P LET X(U,1)=X(U,1)+P:X(V,1)=X(V,1)+P:X(X,2)=X(X,2)+P:X(V,2)=X(V,2)+P
45 IF Q LET X(U,U)=X(U,U)+Q:X(V,V)=X(V,V)+Q:X(X,U)=X(X,U)+Q:X(V,X)=X(V,X)+Q
50 IF R LET X(M,U)=X(M,U)+R:X(M,V)=X(M,V)+R:X(W,U)=X(W,U)+R:X(W,X)=X(W,X)+R
55 NEXT X:FOR X=3 TO W:U=X-1:V=X+1:FOR Y=2 TO U:R=Y-1:S=Y+1:P=Y(X,Y)/6
60 IF P LET X(U,R)=X(U,R)+P:X(U,Y)=X(U,Y)+P:X(X,R)=X(X,R)+P
65 IF P LET X(X,S)=X(X,S)+P:X(V,Y)=X(V,Y)+P:X(V,S)=X(V,S)+P
70 NEXT Y:NEXT X:CALL 26163:NEXT I:P=0:FOR Y=1 TO M:P=P+Y(M,Y):NEXT Y:BEEP 3:PRINT P:END
300 "A"S=0:FOR I=1 TO M:FOR J=1 TO I:S=S+Y(I,J):NEXT J:NEXT I:PRINT S:END


The list of matrix routine addresses can be found in message 51 of this thread. These are the two I used:

26153 - Multiply array X() by scalar variable X and store the result back in X() (in this case, I multiply by 0 to zero out the array)
26163 - Swap X() and Y() arrays
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: [VA] SRC #012a - Then and Now: Probability - Dave Britten - 10-18-2022 12:25 PM



User(s) browsing this thread: 2 Guest(s)