Saturday, 3 July 2021

COBOL Program to Create Hidoku Solution

I read on LinkedIn recently about the continued use of COBOL and decided to write my own program at home. Misty Decker, who is Product Marketing Director at Micro Focus, gave me access to a compiler so then I just had to decide what my program would do.

I wrote a program in the 1980's to do exponentiation to fractional powers as ICL Range COBOL at that time could only calculate square roots. I found the program on some pyjama paper in the loft (it was the only one I bothered to save) and started to retype it. Then I decided that there would be no interest in it nowadays as modern-day COBOL is able to do exponentiation to fractional powers by itself.

I wrote a C program to create solutions for a hidoku puzzle recently but never got round to finishing it so that it could create the puzzle too. I decided to rewrite it, with a view to finishing its development in COBOL.

You can see it running below:

0100,08,01,02,07,08
INPUT PARAMETERS: 0100,08,01,02,07,08
PARAMETERS OK
CALCULATING SOLUTION, PLEASE WAIT
HERE IS A SOLUTION
020 017 018 015 057 056 062 063
021 019 016 014 058 061 055 064
022 023 024 013 060 059 052 054
009 011 012 025 029 030 051 053
010 008 040 041 026 028 031 050
007 005 039 042 027 032 048 049
006 003 004 038 043 034 033 047
002 001 037 036 035 044 045 046

ABOUT TO FINISH
 
Here is the source listing. It needs some tidying up then I need to add code to create the puzzle too. It has also been suggested to me that I should eventually put it on GitHub but I have not got into using that platform yet:
 
* Micro Focus COBOL                  V6.0 revision 000 02-Jul-21 21:27 Page   1
* hidoku.cbl
* Options: list"hidoku.lis"
     1 IDENTIFICATION DIVISION.
     2*
     3 PROGRAM-ID.    HIDOKU.
     4*
     5*    (KING'S TOUR PUZZLE.)
     6*
     7 AUTHOR.        ANDREW S REID.
     8*
     9 DATE-WRITTEN.  MAY 2021.
    10*
    11******************************************************************
    12* VERSION * DATE     * COMMENTS                                  *
    13******************************************************************
    14*       1 * MAY 2021 * ORIGINAL VERSION CREATED FROM EARLIER C   *
    15*                      PROGRAM.                                  *
    16*                      THIS ONLY CREATES A SOLUTION.             *
    17******************************************************************
    18*
    19 ENVIRONMENT DIVISION.
    20*
    21 CONFIGURATION SECTION.
    22*
    23 SOURCE-COMPUTER. BUILT-AT-HOME.
    24*
    25 OBJECT-COMPUTER. BUILT-AT-HOME.
    26*
    27 INPUT-OUTPUT SECTION.
    28*
    29 FILE-CONTROL.

* Micro Focus COBOL                  V6.0 revision 000 02-Jul-21 21:27 Page   2
* hidoku.cbl
    30/
    31 DATA DIVISION.
    32*
    33 FILE SECTION.
    34*
    35 WORKING-STORAGE SECTION.
    36*
    37 01  INPUT-PARAMETERS.
    38     05 RANDOM-NUMBER-SEED PIC 9999.
    39     05 COMMA1             PIC X.
    40     05 SIZE1-INPUT        PIC 99.
    41     05 COMMA2             PIC X.
    42     05 START-COLUMN-INPUT PIC 99.
    43     05 COMMA3             PIC X.
    44     05 START-ROW-INPUT    PIC 99.
    45     05 COMMA4             PIC X.
    46     05 END-COLUMN-INPUT   PIC 99.
    47     05 COMMA5             PIC X.
    48     05 END-ROW-INPUT      PIC 99.
    49*
    50*    THE RANDOM-MOVES ARRAY IS USED DURING SOLUTION CREATION.
    51*    IT DETERMINES WHICH ORDER MOVES ARE SELECTED AT EACH LEVEL.
    52*
    53 01  FILLER1.
    54     05 FILLER2 OCCURS 144.
    55         10 RANDOM-MOVES PIC 9(6) OCCURS 8.
    56*
    57*    THE BOARD ARRAY STORES THE KING'S PROGRESS AROUND THE BOARD.
    58*
    59 01  FILLER3.
    60     05 FILLER4 OCCURS 12.
    61         10 BOARD PIC 9(3) OCCURS 12.
    62*
    63*    POSITION1 WAS CALLED POSITION IN ORIGINAL C PROGRAM BUT THIS
    64*    IS A RESERVED WORD IN COBOL:
    65*
    66 01  FILLER5.
    67     05 FILLER6 OCCURS 144.
    68         10 POSITION1 PIC 9(6) OCCURS 3.
    69*
    70*    ARRAY TO CHECK THAT THERE IS ONLY 1 CONTIGUOUS SET OF EMPTY
    71*    SQUARES:
    72*
    73 01  FILLER7.
    74     05 FILLER8 OCCURS 12.
    75         10 CONNECTIVITY-CHECK PIC 9(6) OCCURS 12.
    76*
    77 77  A PIC 9(6).
    78 77  ACCESSIBILITY PIC 9(6).
    79 77  B PIC 9(6).
    80 77  CONTIGUOUS-SQUARES-FOUND PIC 9(6).
    81 77  DUMMY1 PIC X.
    82 77  END-COLUMN PIC 9(6).
    83 77  END-ROW PIC 9(6).
    84 77  FINISHED PIC 9(6).
    85 77  I PIC 9(6).
    86 77  INACCESSIBLE-SQUARES PIC 9(6).
    87 77  INVALID-PARAMETER-SWITCH PIC X.

* Micro Focus COBOL                  V6.0 revision 000 02-Jul-21 21:27 Page   3
* hidoku.cbl
    88 77  J PIC 9(6).
    89 77  K PIC 9(6).
    90 77  L PIC 9(6).
    91 77  LEVEL PIC 9(6).
    92 77  M PIC 9(6).
    93 77  MOVE-FOUND PIC 9(6).
    94 77  NON-CONTIGUOUS-SQUARES-FOUND PIC 9(6).
    95 77  P PIC 9(6).
    96 77  Q PIC 9(6).
    97 77  RANDOM-NUMBER1      PIC 9(6)V9(6) COMP.
    98 77  RANDOM-NUMBER2      PIC 9(6)V9(6) COMP.
    99 77  RANDOM-NUMBER3      PIC 9(6).
   100*
   101*    SIZE OF BOARD (3 TO 12) I.E. LENGTH OF 1 SIDE.
   102*
   103*    SIZE1 WAS CALLED SIZE IN ORIGINAL C PROGRAM BUT THIS IS A
   104*    RESERVED WORD IN COBOL;
   105*
   106 77  SIZE1 PIC 9(6).
   107*
   108*    SIZE-X-SIZE HOLDS THE NUMBER OF SQUARES IN THE PUZZLE.
   109*
   110 77  SIZE-X-SIZE PIC 9(6).
   111 77  START-COLUMN PIC 9(6).
   112 77  START-ROW PIC 9(6).
   113 77  X PIC 9(6).
   114 77  Y PIC 9(6).
   115
   116 PROCEDURE DIVISION.
   117*
   118 MAIN.
   119*
   120     MOVE ZERO TO INVALID-PARAMETER-SWITCH.
   121     ACCEPT INPUT-PARAMETERS.
   122     DISPLAY "INPUT PARAMETERS: " INPUT-PARAMETERS.
   123*
   124     IF RANDOM-NUMBER-SEED IS NUMERIC
   125         PERFORM GET-RANDOM-NUMBER RANDOM-NUMBER-SEED TIMES
   126     ELSE
   127         DISPLAY "RANDOM NUMBER SEED NOT NUMERIC"
   128         MOVE "1" TO INVALID-PARAMETER-SWITCH.
   129*
   130     IF SIZE1-INPUT IS NOT NUMERIC
   131         DISPLAY "SIDE LENGTH MUST BE NUMERIC"
   132         MOVE "1" TO INVALID-PARAMETER-SWITCH.
   133     IF SIZE1-INPUT < 3 OR SIZE1-INPUT > 12
   134         DISPLAY "SIDE LENGTH MUST BE BETWEEN 3 AND 12"
   135         MOVE "1" TO INVALID-PARAMETER-SWITCH.
   136     MOVE SIZE1-INPUT TO SIZE1.
   137     MULTIPLY SIZE1 BY SIZE1 GIVING SIZE-X-SIZE.
   138*
   139     IF START-COLUMN-INPUT IS NOT NUMERIC
   140         DISPLAY "START COLUMN MUST BE NUMERIC"
   141         MOVE "1" TO INVALID-PARAMETER-SWITCH.
   142     IF START-COLUMN-INPUT < 1 OR START-COLUMN-INPUT > SIZE1
   143         DISPLAY "START COLUMN MUST BE BETWEEN 1 AND " SIZE1
   144         MOVE "1" TO INVALID-PARAMETER-SWITCH.
   145     MOVE START-COLUMN-INPUT TO START-COLUMN.

* Micro Focus COBOL                  V6.0 revision 000 02-Jul-21 21:27 Page   4
* hidoku.cbl
   146*
   147     IF START-ROW-INPUT IS NOT NUMERIC
   148         DISPLAY "START ROW MUST BE NUMERIC"
   149         MOVE "1" TO INVALID-PARAMETER-SWITCH.
   150     IF START-ROW-INPUT < 1 OR START-ROW-INPUT > SIZE1
   151         DISPLAY "START ROW MUST BE BETWEEN 1 AND " SIZE1
   152         MOVE "1" TO INVALID-PARAMETER-SWITCH.
   153     MOVE START-ROW-INPUT TO START-ROW.
   154*
   155     IF END-COLUMN-INPUT IS NOT NUMERIC
   156         DISPLAY "END COLUMN MUST BE NUMERIC"
   157         MOVE "1" TO INVALID-PARAMETER-SWITCH.
   158     IF END-COLUMN-INPUT < 1 OR END-COLUMN-INPUT > SIZE1
   159         DISPLAY "END COLUMN MUST BE BETWEEN 1 AND " SIZE1
   160         MOVE "1" TO INVALID-PARAMETER-SWITCH.
   161     MOVE END-COLUMN-INPUT TO END-COLUMN.
   162*
   163     IF END-ROW-INPUT IS NOT NUMERIC
   164         DISPLAY "END ROW MUST BE NUMERIC"
   165         MOVE "1" TO INVALID-PARAMETER-SWITCH.
   166     IF END-ROW-INPUT < 1 OR END-ROW-INPUT > SIZE1
   167         DISPLAY "END ROW MUST BE BETWEEN 1 AND " SIZE1
   168         MOVE "1" TO INVALID-PARAMETER-SWITCH.
   169     MOVE END-ROW-INPUT TO END-ROW.
   170*
   171     IF START-COLUMN = END-COLUMN
   172         AND START-ROW = END-ROW
   173         DISPLAY "START SQUARE MUST NOT EQUAL END SQUARE"
   174         MOVE "1" TO INVALID-PARAMETER-SWITCH.
   175*
   176     IF INVALID-PARAMETER-SWITCH = ZERO
   177         DISPLAY "PARAMETERS OK"
   178         DISPLAY "CALCULATING SOLUTION, PLEASE WAIT"
   179     ELSE
   180         DISPLAY "ABOUT TO FINISH"
   181         ACCEPT DUMMY1
   182         STOP RUN.
   183*
   184     MOVE ZEROES TO FILLER1, FILLER3, FILLER5.
   185     PERFORM DECIDE-MOVE-ORDER1
   186         VARYING A FROM 1 BY 1 UNTIL A > SIZE-X-SIZE.
   187     MOVE START-COLUMN TO POSITION1 (1,1).
   188     MOVE START-ROW TO POSITION1 (1,2).
   189     MOVE 1 TO BOARD (START-COLUMN,START-ROW).
   190     MOVE 1 TO LEVEL.
   191*
   192*    CONTINUE PROCESSING UNTIL EITHER:
   193*    (1) ALL COMBINATIONS HAVE BEEN TESTED BUT NO SOLUTION HAS
   194*        BEEN FOUND AND THE PROGRAM TRIES TO MOVE THE KING FROM
   195*        ITS ORIGINAL POSITION.
   196*    OR
   197*    (2) A SOLUTION IS FOUND.
   198*
   199     PERFORM FIND-NEXT-MOVE UNTIL
   200         LEVEL < 1 OR
   201         LEVEL NOT < SIZE-X-SIZE.
   202     IF LEVEL = ZERO DISPLAY "NO SOLUTION FOUND".
   203     IF LEVEL = SIZE-X-SIZE

* Micro Focus COBOL                  V6.0 revision 000 02-Jul-21 21:27 Page   5
* hidoku.cbl
   204         DISPLAY "HERE IS A SOLUTION"
   205         PERFORM DISPLAY-BOARD.
   206     DISPLAY "ABOUT TO FINISH".
   207     ACCEPT DUMMY1.
   208     STOP RUN.
   209*
   210 GET-RANDOM-NUMBER.
   211*
   212     COMPUTE RANDOM-NUMBER1 = FUNCTION RANDOM().
   213*
   214 DECIDE-MOVE-ORDER1.
   215*
   216     PERFORM DECIDE-MOVE-ORDER2
   217         VARYING B FROM 1 BY 1 UNTIL B > 8.
   218*
   219 DECIDE-MOVE-ORDER2.
   220*
   221     MOVE 0 TO FINISHED.
   222     PERFORM DECIDE-MOVE-ORDER3 UNTIL FINISHED = 1.
   223*
   224 DECIDE-MOVE-ORDER3.
   225     COMPUTE RANDOM-NUMBER1 = FUNCTION RANDOM().
   226     COMPUTE RANDOM-NUMBER2 = RANDOM-NUMBER1 * 8 + 1.
   227     MOVE RANDOM-NUMBER2 TO RANDOM-NUMBER3.
   228     IF RANDOM-MOVES (A,RANDOM-NUMBER3) = 0
   229         MOVE B TO RANDOM-MOVES (A,RANDOM-NUMBER3)
   230         MOVE 1 TO FINISHED.
   231*
   232 FIND-NEXT-MOVE.
   233*
   234*    LOOK FOR NEXT AVAILABLE MOVE FROM CURRENT POSITION:
   235*
   236D    PERFORM DISPLAY-BOARD.
   237     MOVE ZERO TO MOVE-FOUND.
   238     PERFORM TRY-MOVES THROUGH TRY-MOVES-X UNTIL
   239         POSITION1 (LEVEL,3) NOT LESS THAN 8 OR
   240         MOVE-FOUND = 1.
   241     IF MOVE-FOUND = ZERO
   242         MOVE POSITION1 (LEVEL,1) TO X
   243         MOVE POSITION1 (LEVEL,2) TO Y
   244         MOVE ZERO TO BOARD (X,Y)
   245         MOVE ZERO TO POSITION1 (LEVEL,1),
   246                      POSITION1 (LEVEL,2),
   247                      POSITION1 (LEVEL,3)
   248         SUBTRACT 1 FROM LEVEL
   249     ELSE
   250         ADD 1 TO LEVEL
   251         MOVE X TO POSITION1 (LEVEL,1)
   252         MOVE Y TO POSITION1 (LEVEL,2)
   253         MOVE LEVEL TO BOARD (X,Y).
   254*
   255 TRY-MOVES.
   256*
   257     ADD 1 TO POSITION1 (LEVEL,3).
   258     MOVE POSITION1 (LEVEL,1) TO X.
   259     MOVE POSITION1 (LEVEL,2) TO Y.
   260     MOVE POSITION1 (LEVEL,3) TO P.
   261     MOVE RANDOM-MOVES (LEVEL,P) TO Q.

* Micro Focus COBOL                  V6.0 revision 000 02-Jul-21 21:27 Page   6
* hidoku.cbl
   262     IF Q = 1 ADD 1 TO Y.
   263     IF Q = 2 ADD 1 TO X ADD 1 TO Y.
   264     IF Q = 3 ADD 1 TO X.
   265     IF Q = 4 ADD 1 TO X SUBTRACT 1 FROM Y.
   266     IF Q = 5 SUBTRACT 1 FROM Y.
   267     IF Q = 6 SUBTRACT 1 FROM X SUBTRACT 1 FROM Y.
   268     IF Q = 7 SUBTRACT 1 FROM X.
   269     IF Q = 8 SUBTRACT 1 FROM X ADD 1 TO Y.
   270     IF X < 1 OR X > SIZE1 OR Y < 1 OR Y > SIZE1
   271         GO TO TRY-MOVES-X.
   272     IF BOARD (X,Y) NOT EQUAL ZERO
   273         GO TO TRY-MOVES-X.
   274*
   275*    IT IS ONLY POSSIBLE TO GO TO THE FINAL SQUARE ONCE ALL OTHER
   276*    SQUARES HAVE BEEN VISITED:
   277*
   278     IF X = END-COLUMN AND Y = END-ROW AND
   279         LEVEL NOT EQUAL SIZE-X-SIZE - 1
   280         GO TO TRY-MOVES-X.
   281*
   282*    CHECK THAT ALL THE UNOCCUPIED SQUARES ARE CONTIGUOUS.
   283*    START BY ASSUMING THAT THEY ARE NOT:
   284*
   285     MOVE ZEROES TO FILLER7.
   286*
   287*    FIND THE 1ST UNOCCUPIED SQUARE:
   288*
   289     PERFORM FIND-UNOCCUPIED-SQUARE
   290         VARYING A FROM 1 BY 1 UNTIL A > SIZE1
   291           AFTER B FROM 1 BY 1 UNTIL B > SIZE1.
   292*
   293*    NOW FIND ALL THE EMPTY SQUARES WHICH ARE CONTIGUOUS WITH THIS
   294*    ONE:
   295*
   296     MOVE 1 TO CONTIGUOUS-SQUARES-FOUND.
   297     PERFORM FIND-CONTIGUOUS-SQUARES1
   298         UNTIL CONTIGUOUS-SQUARES-FOUND = ZERO.
   299*
   300*    THE CONNECTIVITY-CHECK ARRAY SHOULD NOW HAVE A LIST OF ALL
   301*    THE EMPTY SQUARES WHICH ARE CONTIGUOUS WITH THE FIRST.
   302*
   303*    NOW SCAN THE BOARD FOR EMPTY SQUARES WHICH ARE NOT CONTIGUOUS
   304*    WITH THIS LIST:
   305*
   306     MOVE ZERO TO NON-CONTIGUOUS-SQUARES-FOUND.
   307     PERFORM FIND-NON-CONTIGUOUS-UNUSED
   308         VARYING A FROM 1 BY 1 UNTIL A > SIZE1
   309           AFTER B FROM 1 BY 1 UNTIL B > SIZE1.
   310     IF NON-CONTIGUOUS-SQUARES-FOUND = 1
   311         GO TO TRY-MOVES-X.
   312*
   313*    NOW SCAN THE BOARD AGAIN FOR INACCESSIBLE SQUARES I.E. THOSE
   314*    WHICH DO NOT HAVE A WAY IN AND OUT:
   315*
   316     MOVE 0 TO INACCESSIBLE-SQUARES.
   317     PERFORM FIND-INACCESSIBLE-SQUARES1
   318     THROUGH FIND-INACCESSIBLE-SQUARES1-X
   319         VARYING I FROM 1 BY 1 UNTIL I > SIZE1

* Micro Focus COBOL                  V6.0 revision 000 02-Jul-21 21:27 Page   7
* hidoku.cbl
   320           AFTER J FROM 1 BY 1 UNTIL J > SIZE1.
   321     IF INACCESSIBLE-SQUARES = 1
   322         GO TO TRY-MOVES-X.
   323     MOVE 1 TO MOVE-FOUND.
   324*
   325 TRY-MOVES-X.
   326*
   327     EXIT.
   328*
   329 FIND-UNOCCUPIED-SQUARE.
   330*
   331     IF BOARD (A,B) = ZERO
   332         MOVE A TO I
   333         MOVE B TO J
   334*    RECORD THIS SQUARE IN THE TABLE WHICH WILL CHECK IF ALL THE
   335*    EMPTY SQUARES ARE CONTIGUOUS:
   336         MOVE 1 TO CONNECTIVITY-CHECK (I,J)
   337*    JUMP OUT OF THE LOOP:
   338         MOVE 9 TO A,B.
   339*
   340 FIND-CONTIGUOUS-SQUARES1.
   341*
   342     MOVE ZERO TO CONTIGUOUS-SQUARES-FOUND.
   343     PERFORM FIND-CONTIGUOUS-SQUARES2
   344         VARYING A FROM 1 BY 1 UNTIL A > 8
   345           AFTER B FROM 1 BY 1 UNTIL B > 8.
   346*
   347 FIND-CONTIGUOUS-SQUARES2.
   348*
   349     IF CONNECTIVITY-CHECK (A,B) = 1
   350         PERFORM FIND-CONTIGUOUS-SQUARES3
   351         VARYING K FROM 1 BY 1 UNTIL K > 8.
   352*
   353 FIND-CONTIGUOUS-SQUARES3.
   354*
   355     IF K = 1
   356        MOVE A TO I
   357        ADD 1 TO B GIVING J ELSE
   358     IF K = 2
   359         ADD 1 TO A GIVING I
   360         ADD 1 TO B GIVING J ELSE
   361     IF K = 3
   362         ADD 1 TO A GIVING I
   363         MOVE B TO J ELSE
   364     IF K = 4
   365         ADD 1 TO A GIVING I
   366         SUBTRACT 1 FROM B GIVING J ELSE
   367     IF K = 5
   368         MOVE A TO I
   369         SUBTRACT 1 FROM B GIVING J ELSE
   370     IF K = 6
   371         SUBTRACT 1 FROM A GIVING I
   372         SUBTRACT 1 FROM B GIVING J ELSE
   373     IF K = 7
   374         SUBTRACT 1 FROM A GIVING I
   375         MOVE B TO J ELSE
   376     IF K = 8
   377         SUBTRACT 1 FROM A GIVING I

* Micro Focus COBOL                  V6.0 revision 000 02-Jul-21 21:27 Page   8
* hidoku.cbl
   378         ADD 1 TO B GIVING J.
   379     IF I NOT LESS THAN 1
   380         AND I NOT > SIZE1
   381         AND J NOT LESS THAN 1
   382         AND J NOT > SIZE1
   383         AND BOARD (I,J) = ZERO
   384         AND CONNECTIVITY-CHECK (I,J) = ZERO
   385         MOVE 1 TO CONNECTIVITY-CHECK (I,J),
   386                   CONTIGUOUS-SQUARES-FOUND.
   387*
   388 FIND-NON-CONTIGUOUS-UNUSED.
   389*
   390     IF BOARD (A,B) = ZERO AND CONNECTIVITY-CHECK (A,B) NOT = 1
   391         MOVE 1 TO NON-CONTIGUOUS-SQUARES-FOUND.
   392*
   393 FIND-INACCESSIBLE-SQUARES1.
   394*
   395     IF BOARD (I,J) NOT = 0
   396         GO TO FIND-INACCESSIBLE-SQUARES1-X.
   397     IF I = X AND J = Y
   398         GO TO FIND-INACCESSIBLE-SQUARES1-X.
   399     IF I = END-COLUMN AND J = END-ROW
   400         GO TO FIND-INACCESSIBLE-SQUARES1-X.
   401     MOVE ZERO TO ACCESSIBILITY.
   402     PERFORM FIND-INACCESSIBLE-SQUARES2
   403     THROUGH FIND-INACCESSIBLE-SQUARES2-X
   404         VARYING K FROM 1 BY 1 UNTIL K > 8.
   405     IF ACCESSIBILITY < 2
   406         MOVE 1 TO INACCESSIBLE-SQUARES.
   407*
   408 FIND-INACCESSIBLE-SQUARES1-X.
   409*
   410 EXIT.
   411*
   412 FIND-INACCESSIBLE-SQUARES2.
   413*
   414     IF K = 1
   415         MOVE I TO L
   416         ADD 1 TO J GIVING M ELSE
   417     IF K = 2
   418         ADD 1 TO I GIVING L
   419         ADD 1 TO J GIVING M ELSE
   420     IF K = 3
   421         ADD 1 TO I GIVING L
   422         MOVE J TO M ELSE
   423     IF K = 4
   424         ADD 1 TO I GIVING L
   425         SUBTRACT 1 FROM J GIVING M ELSE
   426     IF K = 5
   427         MOVE I TO L
   428         SUBTRACT 1 FROM J GIVING M ELSE
   429     IF K = 6
   430         SUBTRACT 1 FROM I GIVING L
   431         SUBTRACT 1 FROM J GIVING M ELSE
   432     IF K = 7
   433         SUBTRACT 1 FROM I GIVING L
   434         MOVE J TO M ELSE
   435     IF K = 8

* Micro Focus COBOL                  V6.0 revision 000 02-Jul-21 21:27 Page   9
* hidoku.cbl
   436         SUBTRACT 1 FROM I GIVING L
   437         ADD 1 TO J GIVING M.
   438     IF L < 1 OR L > SIZE1 OR M < 1 OR M > SIZE1
   439         GO TO FIND-INACCESSIBLE-SQUARES2-X.
   440     IF BOARD (L,M) = 0
   441         ADD 1 TO ACCESSIBILITY.
   442*
   443 FIND-INACCESSIBLE-SQUARES2-X.
   444*
   445 EXIT.
   446*
   447 DISPLAY-BOARD.
   448*
   449     DISPLAY BOARD (8,1) " " BOARD (8,2) " "
   450             BOARD (8,3) " " BOARD (8,4) " "
   451             BOARD (8,5) " " BOARD (8,6) " "
   452             BOARD (8,7) " " BOARD (8,8).
   453     DISPLAY BOARD (7,1) " " BOARD (7,2) " "
   454             BOARD (7,3) " " BOARD (7,4) " "
   455             BOARD (7,5) " " BOARD (7,6) " "
   456             BOARD (7,7) " " BOARD (7,8).
   457     DISPLAY BOARD (6,1) " " BOARD (6,2) " "
   458             BOARD (6,3) " " BOARD (6,4) " "
   459             BOARD (6,5) " " BOARD (6,6) " "
   460             BOARD (6,7) " " BOARD (6,8).
   461     DISPLAY BOARD (5,1) " " BOARD (5,2) " "
   462             BOARD (5,3) " " BOARD (5,4) " "
   463             BOARD (5,5) " " BOARD (5,6) " "
   464             BOARD (5,7) " " BOARD (5,8).
   465     DISPLAY BOARD (4,1) " " BOARD (4,2) " "
   466             BOARD (4,3) " " BOARD (4,4) " "
   467             BOARD (4,5) " " BOARD (4,6) " "
   468             BOARD (4,7) " " BOARD (4,8).
   469     DISPLAY BOARD (3,1) " " BOARD (3,2) " "
   470             BOARD (3,3) " " BOARD (3,4) " "
   471             BOARD (3,5) " " BOARD (3,6) " "
   472             BOARD (3,7) " " BOARD (3,8).
   473     DISPLAY BOARD (2,1) " " BOARD (2,2) " "
   474             BOARD (2,3) " " BOARD (2,4) " "
   475             BOARD (2,5) " " BOARD (2,6) " "
   476             BOARD (2,7) " " BOARD (2,8).
   477     DISPLAY BOARD (1,1) " " BOARD (1,2) " "
   478             BOARD (1,3) " " BOARD (1,4) " "
   479             BOARD (1,5) " " BOARD (1,6) " "
   480             BOARD (1,7) " " BOARD (1,8).
   481     DISPLAY " ".
* Micro Focus COBOL                  V6.0 revision 000 Compiler
* (C) Copyright 1984-2020 Micro Focus or one of its affiliates.
*                                                        REF GNL-069600000AL
* Total Messages:     0
* Data:       11424     Code:        5503

No comments:

Post a Comment