2016 Update
This commit is contained in:
parent
948b86eafa
commit
dcf5d15da3
7965 changed files with 139854 additions and 31002 deletions
|
|
@ -1,6 +1,29 @@
|
|||
* N-queens problem 04/09/2015
|
||||
NQUEENS PROLOG
|
||||
LA R9,1 n=1
|
||||
* N-QUEENS PROBLEM 04/09/2015
|
||||
PRINT NOGEN
|
||||
MACRO
|
||||
&LAB XDECO ®,&TARGET
|
||||
&LAB B I&SYSNDX branch around work area
|
||||
P&SYSNDX DS 0D,PL8 packed
|
||||
W&SYSNDX DS CL13 char
|
||||
I&SYSNDX CVD ®,P&SYSNDX convert to decimal
|
||||
MVC W&SYSNDX,=X'40202020202020202020212060' nice mask
|
||||
EDMK W&SYSNDX,P&SYSNDX+2 edit and mark
|
||||
BCTR R1,0 locate the right place
|
||||
MVC 0(1,R1),W&SYSNDX+12 move the sign
|
||||
MVC &TARGET.(12),W&SYSNDX move to target
|
||||
MEND
|
||||
PRINT NOGEN
|
||||
NQUEENS CSECT
|
||||
SAVE (14,12) save registers on entry
|
||||
PRINT NOGEN
|
||||
BALR R12,0 establish addressability
|
||||
USING *,R12 set base register
|
||||
ST R13,SAVEA+4 link mySA->prevSA
|
||||
LA R11,SAVEA mySA
|
||||
ST R11,8(R13) link prevSA->mySA
|
||||
LR R13,R11 set mySA pointer
|
||||
OPENEM OPEN (OUTDCB,OUTPUT) open the printer file
|
||||
LA R9,1 n=1 start of loop
|
||||
LOOPN CH R9,L do n=1 to l
|
||||
BH ELOOPN if n>l then exit loop
|
||||
SR R8,R8 m=0
|
||||
|
|
@ -92,13 +115,18 @@ E90 BCTR R10,0 i=i-1
|
|||
SLA R1,1 (q+r)*2
|
||||
STH R0,U-2(R1) u(q+r)=0
|
||||
B E60 goto e60
|
||||
ZERO XDECO R9,PG+0 edit n
|
||||
XDECO R8,PG+12 edit m
|
||||
XPRNT PG,24 print buffer
|
||||
ZERO XDECO R9,PG+0 edit N
|
||||
XDECO R8,PG+12 edit M
|
||||
PUT OUTDCB,PG print buffer
|
||||
LA R9,1(R9) n=n+1
|
||||
B LOOPN loop do n
|
||||
ELOOPN EPILOG
|
||||
L DC H'12' input value
|
||||
ELOOPN CLOSE (OUTDCB) close output
|
||||
L R13,SAVEA+4 previous save area addrs
|
||||
RETURN (14,12),RC=0 return to caller with rc=0
|
||||
LTORG
|
||||
SAVEA DS 18F save area for chaining
|
||||
OUTDCB DCB DSORG=PS,MACRF=PM,DDNAME=OUTDD use OUTDD in jcl
|
||||
L DC H'13' input value
|
||||
A DC H'01',H'02',H'03',H'04',H'05',H'06'
|
||||
DC H'07',H'08',H'09',H'10',H'11',H'12'
|
||||
U DC 46H'0'
|
||||
|
|
@ -106,5 +134,5 @@ S DS 12H
|
|||
Z DS H
|
||||
Y DS H
|
||||
PG DS CL24 buffer
|
||||
YREGS
|
||||
REGS make sure to incld copybook jcl
|
||||
END NQUEENS
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue