Advertisement
Guest User

Untitled

a guest
May 4th, 2016
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.82 KB | None | 0 0
  1.  
  2. public class PieceType {
  3.    
  4.    
  5.    
  6.    
  7.     static final int EMPTY = 0, RED = 1, RED_KING = 2, BLACK = 3, BLACK_KING = 4;
  8.  
  9.    
  10.  
  11.  
  12.    
  13.    
  14.      static int [][] locationArray = new int[8][8];
  15.  
  16.    
  17.    
  18.      
  19.        
  20.         PieceType(int type) {
  21.  
  22.             //piece = type;
  23.            
  24.         }
  25.        
  26.    
  27.   public static int[][] typeOfPiece(int row, int col) {
  28.      
  29.      
  30.              if ( row % 2 == col % 2 ) {
  31.                 if (row < 3)
  32.                    locationArray[row][col] = BLACK;
  33.                 else if (row > 4)
  34.                    locationArray[row][col] = RED;
  35.                 else
  36.                    locationArray[row][col] = EMPTY;
  37.              }
  38.              else {
  39.                 locationArray[row][col] = EMPTY;
  40.              }
  41.          
  42.        
  43.         return locationArray;
  44.   }
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement