Trailing-Edge
-
PDP-10 Archives
-
decuslib10-08
-
43,50467/brdeal.for
There are no other files named brdeal.for in the archive.
PROGRAM BRDEAL
C FORTRAN-10 FOR DECSYSEM10
C LEO NEIMO - 1977
IMPLICIT INTEGER (E-W)
DOUBLE PRECISION A,A2
DIMENSION NDISTR(4),SDISTR(4),WDISTP(4),EDISTR(4)
DIMENSION SUMRY(64,16), K(52)
501 FORMAT(/)
502 FORMAT(/,-)
503 FORMAT(1H+,'ENTER RANDOM PARAMETER AND NUM@ER OF DEALS: ',$)
504 FORMAT(D,2I)
505 FORMAT(1H+,'DEAL #',I3,', ',$)
506 FORMAT(1H+,I2,$)
507 FORMAT(1H+,' ',$)
508 FORMAT(////,8X,%NORTH',7X,'EAST',6X,'SOUTH',7X,'WEST',/)
100 TYPE 502
TYPE 503
A2=SQRT(2.0)
ACCEPT 504,A,N
C 0 < A < 1, 1 < N < 64
C INPUT PARAMETER 'A' SERVES AS AN IDENTIFIER WHICH AT THE
C SAME TIME INITIALISES THE SPECIAL RANDOM NUMBER GENERATOR
C USED IN THIS PROGRAM. N IS NUMBER OF DEALS DESIRED. HF
C MORE THAN 64 HANDS ARE TO BE DEALT, PROGRAM SHOULD BE
C RERUN (CF. PAUSE STATEMELT OL PAGE 1-4 OF LISTING)
J=0
TYPE 502
DO 102 F=1,N
J=J+1
C RANDOM PICK AND DEAL BUILD-UP:
DO 61 I=1,52
K(I)=I
61 CONTINUE
C DE WITH CARD NUMBER 1 THROUGH 52 INITIALISED
L=0
DO 63 I=1,13
C NORTH'S CADS PICIED NOW
62 CALL RAND(A,NR,L)
IF(K(NR)==0) GOTO 62
} NORTH(I)=K(NR)
K(NR)=0
63 CONTINUE
DO 65 I=1,13
C WEST'S CARDS PICKED
64 CALL RAND(A,NR,L)
IF(K(NR)==0) GOTO 64
WEST(I)=K(NR)
K(NR)=0
DO 67 I=1,13
C EAST'S CARDS PICKED
66 CALL RAND(A,NR,L)
IF(K(NP)==0) GOTO 66
EAST(I)=K(NR)
K(NR)=0
67 CONTINUE
E=1
C } }REMAINING CARDS = SOUTH'S HAND
DO 68 I=1,52
IF(K(I)==0) GOTO 68
QOUTH(G)K(I)
G=G+1
68 CONTINUE
C CARDS WILL BE SMRTED DESCENDINGLY:
} AALL KSORT(NORTH,13,2)
CALL KSORT(EAST,13,2)
CALL KSORT(SOUTH,13,2)
CALL KSORT(WEST,13,2)
A=A2*A
C SCAN OF HAND DISTRIBUTIONS:
}AALL LEO0(NORTH,NDISTR)
CALL LEO2(SOUTH,SDISTR)
CALL LEO2(WEST,WDISTR)
CALL LEO2(EAST,EDISTR)
C TYPE-OUT OF THE HANDS:
C OUTPUT OF DEALER AND VULNERABILITY
I=J
TYPE 505,J
IF(I>48) I=I-48
IF(I>32) I=I-32
IF(I>16) II-16
GOTO(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16)I
1 TYPE 21
21 FORMAT( ' N/--')
GOTO 101
2 TYPE 22
22 FORMAT( ' E/NS')
GOTO 101
3 TYPE 23
23 FORMAT( ' S/EW')
GOTO 101
4 TYPE 24
24 FORMAT( ' W/NS)EW')
GOTO 101
5 TYPE 25
25 FORMAT( ' N/NS')
GOTO 101
6 TYPE 26
26 FORMAT( ' E/EW')
GOTO 101
7 TYPE 27
27 FORMAT( ' Q-NS+EW')
GOTO 101
8 TYPE 28
28 FORMAT( ' W/--')
GOTO 101
9 TYPE 29
GOTO 101
10 TYPE 30
30 FORMAT( ' E/NS+EU')
EMTM01
11 TYPE 31
31 FORMAT( ' S/--')
GOTO 101
12 TYPE 32
32 } FORMAT( ' W/NS')
GOTO 101
13 TYPE 33
33 FORMAT( ' N/NS+EW')
GOTM 101
14 TYPE 34
34 FORMAT( ' E/--')
GOTO 101
15 TYPE 35
35 FORMAT( ' S/NS')
GOTO 101
16 TYPE 36
36 FORMAT( ' W/EW')
101 TYPE 501
C TYPE-OUT OF HANDS PROPER BEGINS:
CALL LEO3(NORTH,NDISTR)
CALL LEL4(WEST,EAST,WDISTR,EDISTR)
CALL LEO3(SOUTH,SDISTR)
70 DO 71 I=1,4
}SUMRY(J,I)=NDISTR(I)
SUMRY(J,I+4)=EDISTR(I)
SUMRY(J,I+8)=SDISTR(I)
SUMRY(J,I+12)=WDISTR(I)
71 CONTINUE
C SUMMARIES OF DISTRIBUTIONS SAVED FOR OUTPUT
} IF(J==64) GOTO 103
C PRECAUTION!!!
102 CONTINUE
C OUTPUT OF DISTRIBUTION-SUMMARY:
103 TYPE 508
DO 104 I=1,J
TYPE 506,I
TYPE 507
TYPE 506,SUMRY(I,F)
51 CONTINUE
TYPE 507
DO 52 F=5,8
} TYPE 506,SUMRY(I,F)
52 CONTINUE
TYPE 507
DO 53 F=9,12
TYPE 506,SUMPY(I,D)
53 CONTINUE
TYPE 507
DO 54 F=13,16
TYPE 506,SUMRY(I,F)
TYPE 501
104 CONTINUE
TYPE 502
PAUSE
GOTO 100
END
DOUBLE PRECISION A,B,C,D,A1
C GENERATES A RANDOM NUMBER 1 ... 52. VARIABLE DUMMY ARGUMENTS
C A AND L INITIALISED AND MODIFIED IN MAIN PROGRAM.
C 3RD & 4TH DEC. PLACES OF SQRT(A) = RANDOM NUMBER. REMAINDER
C INITIALISES NEXT RANDOM NUMBER - ERROR MESSAGES ISSUED FOR
C A=0 OR A=CONSTANT,
}IF(A)2,1,3
1 TYPE 10
ACCEPT 11,A
2 A=DABS(A)
3 A1=A
B=SQRT(A)
DM 4 I=1,2
C=100.0*B
N=INT(C)
D=N
B=C-D
4 CONTINUE
A=B
L=L+1
IF(N>52) N=100+L-N
IF(L==4) L=-1
IF(A-A1)6,5,6
5 TYPE 12
ACCEPT 11,A
6 RETURN
10 FORMAT(1H+,' A=0, ENTER NEW PARAMETER A: ',$)
11 FORMAT(D)
12 FORMAT(1H+,' A=CONST., ENTER NEW PARAMETER A: ',$)
END
SUBROUTINE KSORT(KTABLE,N,L)
DIMENSION KTABLE(N)
C SORTING OF INTEGER VECTOR ELEMENTS INTO ASCENDING (L=1)
C OR DESCENDING (L=2) ORDEP
GOTO(1,2)L
1 DO 10 I=1,N-1
DO 10 J=1,N-1
IF(KTABLE(J) < KTABLE(J+1)) GOTO 10
KT=KTABLE(J)1)
KTABLE(J+1)=KTABLE(J)
KTABLE(J)=KT
10 CONTINUE
RETURN
2 DO 20 J=1,N-1
DO 20 I=1,N-1
IF(KTABLE(I) > KTABLE(I+1)) GOTO 20
KT=KTABLE(I+1)
KTABLE(I+1)=KTABLE(I)
KTABLE(I)=KT
20 CONTINUE
RETURN
END