home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 10 / 10.iso / l / l360 / 3.ddi / APPC.@EM / BATTLER.CBL < prev   
Encoding:
Text File  |  1991-04-08  |  4.1 KB  |  85 lines

  1.       $set mf ans85 noosvs
  2.       *******************************************************************
  3.       *                                                                 *
  4.       *                                                                 *
  5.       *                  (C) Micro Focus Ltd. 1990                      *
  6.       *                                                                 *
  7.       *                         BATTLER.CBL                             *
  8.       *                                                                 *
  9.       *      COBOL Advanced Program to Program (APPC) Demonstration     *
  10.       *                                                                 *
  11.       *                         Battleships                             *
  12.       *                          player  2                              *
  13.       *                                                                 *
  14.       *******************************************************************
  15.  
  16.        WORKING-STORAGE SECTION.
  17.  
  18.        01 Player-Id            pic x(7) value 'PLAYER2'.
  19.       *-----------------------------------------------------------------
  20.       *    Battle-Grid defines the grid positions of different ships
  21.       *    on this side.  It is up to each player to specify these
  22.       *    positions and follow certain requirements of the game.
  23.       *
  24.       *    The requirements are:
  25.       *        - ships are identified by the following letters:
  26.       *                 A for Aircraft Carrier
  27.       *                 B for Battleship
  28.       *                 F for Frigate
  29.       *                 G for Gun Boat
  30.       *
  31.       *        - ships can be any length - it is up to the players to
  32.       *          decide how long each ship is
  33.       *
  34.       *        - ships must not be located in adjacent grid locations
  35.       *
  36.       *        - ships can only be aligned vertically or horizontally
  37.       *
  38.       *    There is no verification done on the setup you choose - so
  39.       *    it is quite possible to cheat.  You must also recompile this
  40.       *    program when you want to change the battle grid.
  41.       *
  42.       *    A possible enhancement which you may like to make yourself
  43.       *    would be to provide code which allows each player to define
  44.       *    his/her own grid details and validate the grid dynamically -
  45.       *    thus removing the need to recompile every time.
  46.       *
  47.       *-----------------------------------------------------------------
  48.  
  49.        01 Battle-Grid.
  50.        88 No-Ships-Left        value spaces.
  51.           03 filler            pic x(13) value 'G            '.
  52.           03 filler            pic x(13) value '  FF     BBB '.
  53.           03 filler            pic x(13) value '             '.
  54.           03 filler            pic x(13) value ' A      G    '.
  55.           03 filler            pic x(13) value ' A           '.
  56.           03 filler            pic x(13) value ' A           '.
  57.           03 filler            pic x(13) value ' A  G     F  '.
  58.           03 filler            pic x(13) value '          F  '.
  59.           03 filler            pic x(13) value '   BBB       '.
  60.  
  61.       *-----------------------------------------------------------------
  62.        COPY "BATTLE.WKS".
  63.       *    BATTLE.WKS is a copy file that contains common
  64.       *    working-storage section items for PLAYER1 and PLAYER2
  65.       *
  66.       *-----------------------------------------------------------------
  67.  
  68.        SCREEN SECTION.
  69.       *-----------------------------------------------------------------
  70.        COPY "BATTLE.SS".
  71.       *    BATTLE.SS is a copy file containing a screen section for
  72.       *    displaying the battle field.  The screen section was designed
  73.       *    using the SCREENS utility.
  74.       *
  75.       *-----------------------------------------------------------------
  76.  
  77.        PROCEDURE DIVISION.
  78.       *-----------------------------------------------------------------
  79.        COPY "BATTLE.CPY".
  80.       *    BATTLE.CPY is a copy file containing the common procedure
  81.       *    division code for both players
  82.       *
  83.       *-----------------------------------------------------------------
  84.  
  85.