93 lines
1.9 KiB
Java
93 lines
1.9 KiB
Java
/**
|
|
* <PRE>
|
|
* MoveablePiece.java
|
|
*
|
|
* Revisions: 1.0 Nov. 11, 2002
|
|
* Created the MoveablePiece class
|
|
* 1.1 Nov. 11, 2002
|
|
* Compiled, Finished, Done
|
|
*
|
|
* </PRE>
|
|
*
|
|
* Collaboration Statement:
|
|
* I worked on the homework assignment alone, using only
|
|
* course materials.
|
|
*
|
|
* Created with JCreatorLE, some indents are off when viewed through notepad
|
|
* or EMACS
|
|
*
|
|
* @author <A HREF="mailto:gtg184g@mail.gatech.edu">Jose Manuel Caban</A>
|
|
* @version Version 1.1, Nov. 11, 2002
|
|
*/
|
|
|
|
public abstract class MoveablePiece extends GamePiece implements P6Constants{
|
|
|
|
////////////////
|
|
//Constructors//
|
|
////////////////
|
|
|
|
/**
|
|
*Constructor
|
|
*@param x, the x coordinate
|
|
*@param y, the y coordinate
|
|
*/
|
|
public MoveablePiece(int x, int y){
|
|
super(x,y);
|
|
}
|
|
|
|
///////////
|
|
//Methods//
|
|
///////////
|
|
|
|
/**
|
|
*Move the piece in a direction
|
|
*@param direction to be moved
|
|
*/
|
|
public void move(int direction){
|
|
switch(direction){
|
|
case NORTH:
|
|
//if(y==0){}
|
|
//else{
|
|
y--;
|
|
//}
|
|
break;
|
|
case EAST:
|
|
//if(x==max){}
|
|
//else{
|
|
x++;
|
|
//}
|
|
break;
|
|
case SOUTH:
|
|
//if(y==max){}
|
|
//else{
|
|
y++;
|
|
//}
|
|
break;
|
|
case WEST:
|
|
//if(x==0){}
|
|
//else{
|
|
x--;
|
|
//}
|
|
break;
|
|
default:
|
|
System.err.println("How the heck did you do this");
|
|
break;
|
|
}
|
|
}
|
|
|
|
/*************************************************************/
|
|
|
|
/**
|
|
* Debugging main for class MoveablePiece.
|
|
* This method will rigorously test my code.
|
|
*
|
|
* <br><br>
|
|
* @param args a String array of command line arguments.
|
|
*/
|
|
public static void main(String[] args) {
|
|
|
|
|
|
}// end of main(String[] args)
|
|
|
|
}// end of class MoveablePiece
|