home *** CD-ROM | disk | FTP | other *** search
/ The Net: Ultimate Internet Guide / WWLCD1.ISO / pc / java / enxle1f6 / src / games / battle / client / clientapplet / clientboard.java < prev    next >
Encoding:
Java Source  |  1996-08-14  |  1.7 KB  |  79 lines

  1. /*
  2.  * @(#)ClientBoard.java
  3.  */
  4.  
  5. package games.Battle.client.ClientApplet;
  6.  
  7. import java.awt.*;
  8. import games.Battle.shared.sys.*;
  9.  
  10. /**
  11.  * The ClientBoard is the subclass of the Board class which is
  12.  * responsible for maintaining the client version of the game 
  13.  * board. Its fundamental purpose is to create the appropriate
  14.  * ClientCell in its makeCell method.
  15.  *
  16.  * @author Alex Nicolaou
  17.  * @author Jay Steele
  18.  */
  19. public class ClientBoard extends Board
  20. {
  21.     /**
  22.      * Construct a client game board.
  23.      */
  24.     public ClientBoard() {
  25.         super();
  26.     }
  27.  
  28.     /**
  29.      * Creates a ClientCell cell for the client game board.
  30.      * @param r the row the cell is being created for
  31.      * @param c the column the cell is being created for
  32.      * @see ClientCell
  33.      */
  34.     public Cell makeCell(int r, int c) {
  35.         return (new ClientCell(r, c));
  36.     }
  37.  
  38.     /**
  39.      * Debugging method
  40.      */
  41.     public void asciiDump() {
  42.         for (int r=0; r< Rules.rows; r++) {
  43.             for (int c=0; c< Rules.cols; c++) {
  44.                 ClientCell cell = (ClientCell)getCell(r,c);
  45.                 switch (cell.getOccupancy()) {
  46.                     case Symbols.PLAYER0:
  47.                         System.out.print("0 ");
  48.                         break;
  49.                     case Symbols.PLAYER1:
  50.                         System.out.print("1 ");
  51.                         break;
  52.                     case Symbols.PLAYER2:
  53.                         System.out.print("2 ");
  54.                         break;
  55.                     case Symbols.PLAYER3:
  56.                         System.out.print("3 ");
  57.                         break;
  58.                     case Symbols.PLAYER4:
  59.                         System.out.print("4 ");
  60.                         break;
  61.                     case Symbols.UNOCCUPIED:
  62.                         System.out.print(". ");
  63.                         break;
  64.                     case Symbols.INVISIBLE:
  65.                         System.out.print("X ");
  66.                         break;
  67.                     case Symbols.UNMODIFIED:
  68.                         System.out.print("U ");
  69.                         break;
  70.                     default:
  71.                         System.out.print("? ");
  72.                         break;
  73.                 }
  74.             }
  75.             System.out.println();
  76.         }
  77.     }
  78. }
  79.