Trailing-Edge
-
PDP-10 Archives
-
decuslib10-01
-
43,50150/bridge.sno
There are 2 other files named bridge.sno in the archive. Click here to see a list.
DATA('CARD(NUM,NEXT)')
*
OUTPUT('TITLE',6,'(14H1THIS IS HAND ,22A5)')
OUTPUT('DEALER',6,'(11H DEALER IS ,22A5)')
OUTPUT('SKIP',6,'(A1)')
*
*
* FUNCTIONS
*
DEFINE('INSERT(LIST,CARD)TEMP') :(INSERTEND)
*
INSERT $LIST = IDENT($LIST) CARD(NUM(CARD),NULL) :S(RETURN)
$LIST = GT(NUM(CARD),NUM($LIST)) CARD(NUM(CARD),$LIST)
. :S(RETURN)
TEMP = $LIST
INS1 IDENT(NEXT(TEMP)) :S(INS2)
NEXT(TEMP) = GT(NUM(CARD),NUM(NEXT(TEMP)))
. CARD(NUM(CARD),NEXT(TEMP)) :S(RETURN)
TEMP = NEXT(TEMP) :(INS1)
INS2 NEXT(TEMP) = CARD(NUM(CARD),NULL) :(RETURN)
INSERTEND
*
*
DEFINE('LINE(STR1,COL1,STR2,COL2)BL1,BL2') :(LINEEND)
*
LINE BL LEN(COL1 - 1) . BL1
IDENT(STR2) :S(LINE1)
BL LEN(COL2 - (COL1 + SIZE(STR1))) . BL2
LINE1 LINE = BL1 STR1 BL2 STR2 :(RETURN)
LINEEND
*
*
DEFINE('NTH(LIST,NUM)TEMP') :(NTHEND)
*
NTH NTH = EQ(NUM,0) $LIST :F(NTH1)
$LIST = NEXT($LIST) :(RETURN)
NTH1 TEMP = $LIST
NTH2 NUM = NUM - 1
NTH = EQ(NUM,0) NEXT(TEMP) :S(NTH3)
TEMP = NEXT(TEMP) :(NTH2)
NTH3 NEXT(TEMP) = NEXT(NEXT(TEMP)) :(RETURN)
NTHEND
*
*
DEFINE('RANDOM(N)') :(RANDOMEND)
RANDOM RAN.VAR = RAN.VAR * 1061 + 3251
RAN.VAR ARB RPOS(5) =
RANDOM = (RAN.VAR * N) / 100000 :(RETURN)
RANDOMEND
*
*
DEFINE('SUITL(HAND,SUIT)') :(SUITLEND)
*
SUITL SUITL = SUIT ' '
SUITL1 GT(NUM($HAND),$SUIT) :F(RETURN)
SUITL = SUITL $(NUM($HAND) - $SUIT)
$HAND = DIFFER(NEXT($HAND)) NEXT($HAND) :S(SUITL1)F(RETURN)
SUITLEND
*
*
* CONSTANTS
*
BL = ' '
. ' '
S = 39
H = 26
D = 13
C = 0
$1 = 2
$2 = 3
$3 = 4
$4 = 5
$5 = 6
$6 = 7
$7 = 8
$8 = 9
$9 = 10
$10 = 'J'
$11 = 'Q'
$12 = 'K'
$13 = 'A'
DEALSEQ = 'NORTH,EAST,SOUTH,WEST,NORTH,'
RAN.VAR = 157
DEALMAX = 3
NTHDEAL =
DEAL = 'WEST'
NEWDEAL NTHDEAL = LT(NTHDEAL,DEALMAX) NTHDEAL + 1 :F(END)
N = 1
NORTH =
EAST =
SOUTH =
WEST =
DECK =
DLOOP DECK = CARD(N,DECK)
N = LT(N,52) N + 1 :S(DLOOP)
DEALSEQ DEAL ',' BREAK(',') . DEAL :F(ERR)
HAND = DEAL
N = 52
NLOOP DEALSEQ HAND ',' BREAK(',') . HAND :F(ERR)
INSERT(HAND,NTH('DECK',RANDOM(N)))
N = GT(N,1) N - 1 :S(NLOOP)
*
*
* OUTPUT OF HAND
*
TITLE = NTHDEAL
DEALER = DEAL
SKIP = ' '
OUTPUT = LINE('NORTH',40)
OUTPUT =
OUTPUT = LINE(SUITL('NORTH','S'),40)
OUTPUT = LINE(SUITL('NORTH','H'),40)
OUTPUT = LINE(SUITL('NORTH','D'),40)
OUTPUT = LINE(SUITL('NORTH','C'),40)
SKIP = ' '
OUTPUT = LINE('WEST',20,'EAST',60)
OUTPUT =
OUTPUT = LINE(SUITL('WEST','S'),20,
. SUITL('EAST','S'),60)
OUTPUT = LINE(SUITL('WEST','H'),20,
. SUITL('EAST','H'),60)
OUTPUT = LINE(SUITL('WEST','D'),20,
. SUITL('EAST','D'),60)
OUTPUT = LINE(SUITL('WEST','C'),20,
. SUITL('EAST','C'),60)
SKIP = ' '
OUTPUT = LINE('SOUTH',40)
OUTPUT =
OUTPUT = LINE(SUITL('SOUTH','S'),40)
OUTPUT = LINE(SUITL('SOUTH','H'),40)
OUTPUT = LINE(SUITL('SOUTH','D'),40)
OUTPUT = LINE(SUITL('SOUTH','C'),40)
. :(NEWDEAL)
END
*** END OF TEST PROGRAM 3 ***